Python Programming Quiz 1 AKTU KNC402

 Python Programming Quiz 1 AKTU KNC402





Hi, in this article I will explain all the questions with answers to python programming.

1. What is the first step in write a program?

  • Run Code’
  • Write Code
  • Edit Code
  • Check Code

Reason- The first step in write a program is just to write a code in notepad++, or another framework.

2. Logical solution is a ______ and clear ______ procedure to solve the problem, known as _____.

  • problem description, step by step, flowchart
  • expression, assignment statement, identifier
  • finite, step by step, Algorithm
  • finite, assignment statement, algorithm

Reason- The approach for solving a problem must be step by step called algorithm and it must be clear and finite.

3. Python is a/an _____ language (unlike c, c++, java).

  • Logical Programming
  • Interpreted Programming
  • Compiled Programming
  • Complex Programming

Reason- Python is called an interpreter programming language because python has an interpreter which converts byte code into machine code.

4. What is the extension of a python file?

  • .Pi
  • .Pyt
  • .Py
  • .Ptn

Reason- The extension of the python file is .py

5. In Python variable can be thought of as

  • labels
  • containers
  • boxes
  • tumblers

Reason- in python variables are like a container that stores information and data.

6. Which function is used to get a String in Title cases(first letter of each word in capital) ?

  • pint()
  • title()
  • strip()
  • lstrip()

Reason- Title() function is used for converting string’s first letter into uppercase.

7. Which function is used to get rid of the blank spaces on the left ?

  • strip()
  • left()
  • rstrip()
  • lstrip()

Reason- lstrip() function is used to get rid of the blank spaces on the left.

8. A python program is a sequence of ____ and _____.

  • data and information
  • classes and objects
  • strings and arrays
  • definitions and commands

Reason- A python program is a sequence of classes and objects because in python we treat everything as a object.

9. What will be output of : type(3.5) ?

  • class double
  • class str
  • class int
  • class float

Reason- type(3.5) is a floating point number.

10. What will be the output of : int(2.5) ?

  • 1
  • 3
  • 2
  • 2.5

Reason- int(2.5) is an integer variable and will return an integer number 2 as an output.

11. An input that you take in python is of_____ data type.

  • str
  • int
  • float
  • char

Reason- input in python is predefined function and return string.

12. What is the output of the following : 4//5 ?

  • 1
  • 0.8
  • 0
  • 8

Reason- Output of 4//5 is 0 because // operator works on greatest integer function which always return floor value.

13. What will be the value stored in y? x,y,z -1,2,3

  • 1
  • 2
  • 3
  • none of these

Reason- z will be stored in y because whenever we take input like this then first value store in first variable and second value store in second variable and soo on…

14. Which of the following is valid identifier or variable?

  • well&I
  • well I
  • well_I
  • @well

Reason- well_I is a valid identifier or variable name

Post a Comment

0 Comments

×
×
×