Python MCQ Book pdf Download | Python MCQ pdf Download | Python Functions MCQ

 

1. Which of the following memory is used to store temporary results in registers when the computation is in piope

a. Primary Memory

b Secondary Memory

c. Internal Memory

d. None of the above

2. Secondary memory is also called…..

a. Storage Memory

b. External Memory

c. Only b

d. Both a and b

3. ……….is used to translate a program written in a high-level language into its equivalent machine code.

a. Compiler

b. Linker

c. Loader

d. Both a and b

4. …….. is used to relocate executable programs to the main memory during execution.     

a. Linker  

b. Compiler

c. Interpreter

d. Loader

5. What is the correct syntax for the print statemenit in Python 3.0?

a. print()

b. print

c. print ()

d. None of the above

6. Which of the following symbols is used to make single line comments in Python? 

a. #

b. ‘

c. ”’

d. &

Python Programming Multiple Choice Questions and Answers pdf | Python MCQ Questions and Answers pdf

1 Which of the following is not a valid identifier

a.A_

b. _A

c. 1a

d. _1

2. Which of the following is an invalid statement?

a. w.X.YZ = 1.00,000,0000

b. WXYZ = 1,0,00,000

c. WXYZ-10 10 11 10

d. W_X_Y= 1,100,1000

3. Which of the following is not a complex number?

a. A-1+2j

b. B- complex(1,2)

c. C-2+ 21

d.None of the above

4. What is the output of the following statement?

round(1.5-round (-1.5) by 

a. 1

b. 2

c. 3

d. 4

5. What is the output of the following statement?

print’is,”. formati’100000′))

a. 1,00,000 

b. 1.0,0,0,0,0

c. 10,00,00,0

d. Error

6. Which type of error will occur on executing the following statement?

Name = MyName

a. Syntax Error

b. Name Error

c. Type Error

d. Value Error

7. What is the output of following statement?  

Sum= 10 + ’10’

a. 1010

b. 20

c. TypeError

d. None of the above

8. What will be printed if we write

print) statement as PriNt (“Hello Python!”)

a. Hello Python

b. Syntax Error

c. Name Error

d. Both a and b

9. Which of the following is a valid input() statement?

a. x = input(Enter number:)

b. X= Input(Eniter number: )

c. X = input(‘Enter number: ‘)

d. X= Input(‘Enter Number: ‘)

10. What will be the output of the following statement if the user has entered 20 as the value of x.

x = input (‘Enter Number: ‘) print (10 + x)

a. 1010

b. 20

c. 30

d. Error

11. Which line of code creates a variable ‘num’ with the value 105?

a. num equals 105

b.num is 105

c. 105= num

d. num= 105

12. Which of the following statement is correct on execution of following lines of code.

x = “Welcome” y = True

a. x is a string and y is a boolean

b. x is an integer and y is a boolean

c. x is a string and y is a float

d. x is an integer and y is a float

13. Which of the following function will return ASCII value of character?

a . ascii()

b. ord()

c. Both a and b

d. None of the above 

14. What will be the output of the following statement?

a. Returns the largest value greater than x

b. Returns the largest value not greater than

c. Both and b

d. None of the above

15. By default what is justification in order to display string on to the console

a. Center 

b. Left

c. Right

d. None of the above

Python Programming Quiz with Answers | Python Quiz Questions and Answers | Python MCQ Online Test

1. What will be the output of the following expression if it is executed in Python interactive mode 16 % 3

a. 5

b. 1 

c. 0

d.-1

2. What will bethe output of the following program?

X=5 Y=5 print (X/Y)

a. 1

b. 1.0

c. 0.1

d. None of the above

3. What will be the output of the following statement?

print(15 + 20/5+3* 2-1)

a 19.0

b 19

c 12.0

d. 24.0

4. What will be the output of the following progratm?

A= 7 B= 4 C=2 print(a//b/c)

a 0.85

b. 0

C 0.5

d. 0.0

6. What will be the output of the following expression?

4*1**2

a. 16

b. 4

c. 8

d. 1

7. What will be the output of the following program?

x =4.6 Y = 15 Z= X/Y print (Z)

a. 0

b. 0.0

c. 0.30

d. None

8. Operators with the same precedence are evaluated in which of the following orders?

a. Left to Right

b. Right to Left

c. Unpredictable

d. None of the above

9. What will be the output, if the input data 5 is shifted towards the left by 2 bits?

a. 20

b. 10

c: 1 

d. 25

10. Which of the following have the highest precedence in an expression?

a. Addition 

b. Multiplication

c. Exponent

d. Parenthesis

11. What is the output of the following statement?

>>>4 !=

a. None

b. True

c. False

d. Error

12. What is the output of the following comparison operator?

>>>10 >= 10

a. False

b. True

c. None

d. Error

13. What are the characteristics of and operator?

a. The and operator returns True only if both operands are True.

b. The and operator returns True if exactly one of the operands is True

c. The and operator returns True if at least one of the operands is True.

d. The and operator returns True if neither operands is True.

14. What is the characteristic of the or operator?

a. The or operator returns True only if both operands are True.

b. The or operator returns True if exactly one of the operands is True.

c. The or operator returns True if at least one of the operands is True.

d. The or operator returns True if neither operands is True.