[go: up one dir, main page]

0% found this document useful (0 votes)
12 views5 pages

PP Objective Question Bank

The document contains a series of multiple-choice questions (MCQs), fill-in-the-blanks, and true/false statements related to Python programming. It covers various topics including operators, data types, control flow, and functions. The questions are designed to test knowledge and understanding of Python syntax and behavior.

Uploaded by

jagadeshrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views5 pages

PP Objective Question Bank

The document contains a series of multiple-choice questions (MCQs), fill-in-the-blanks, and true/false statements related to Python programming. It covers various topics including operators, data types, control flow, and functions. The questions are designed to test knowledge and understanding of Python syntax and behavior.

Uploaded by

jagadeshrao
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Objective Questions (MCQs)

1. What will be the output of print(5 / 2 * 3) in Python?


a) 7.5
b) 6
c) 3
d) 2
2. The input() function takes user’s input as a
a) integer
b) float
c) string
d) character
3. How can we execute a Python script from the command line?
a) python script.py
b) run script.py
c) execute script.py
d) start script.py
4. If x = 3 and y = 5, what is the output of print(x < y and x > 0)?a
a) True
b) False
c) None
d) Error
5. Which of the following results in True?
a) >>>9=9 and 1==1
b) >>>3==5 and 7==3
c) >>>7!=1 and 5==5
d) >>4<1 and 1>6
6. What is the result of bool([]) in Python?
a) True
b) False
c) Error
d) None
7. What does ord('A') return in Python?d]
a) 65
b) ‘A’
c) ASCII code of ‘A’
d) Both a and c
8. What will be the output of the following code?

for i in range(4):
if i == 1:

break

print(i)

a) 0 1 2 3
b) 0 1 2
c) 0
d) No output

9. Which operator has the highest precedence in Python?


a) + (Addition)
b) * (Multiplication)
c) ** (Exponentiation)
d) % (Modulus)
10.What is the purpose of the pass statement in Python?
a) To break the loop
b) To continue the loop
c) To act as a placeholder
d) To throw an error
11.What will be the output of the following code?

x = 10
y = x // 3
print(y)

a) 3.33
b) 3
c) 3.0
d) Error

12.What does is operator check in Python?


a) Value of two variables
b) Memory location of two variables
c) Data type of variables
d) Both a and b
13.What will be the output of print(10 | 5)?
a) 2
b) 10
c) 15
d) 5
14.Which statement will correctly take a floating-point number as input?-b
a) x = input(float("Enter a number: "))
b) x = float(input("Enter a number: "))
c) x = int(float(input("Enter a number: ")))
d) x = str(float(input("Enter a number: ")))
15.What is the output of print(type(True + False))?
a) bool
b) int
c) str
d) float
16.What will be the output of the following code?

x=0

while x < 3:

x += 1

if x == 2:

continue

print(x)

a)1 2 3
b) 1 3
c) 1 2
d) No output

17.Which of the following correctly represents the syntax of an if-elif-else


statement?
a) if (condition): elif (condition): else:
b) if condition: elif condition: else:
c) if condition { } elif condition { } else { }
d) if condition elif condition else

Fill in the Blanks

1. In Python, __________ function is used to get input from the user.


2. The __________ operator is used for exponentiation in Python.
3. A Python comment starts with the symbol __________.
4. The result of 3 and 0 in Python is __________.
5. The __________ function returns the memory address of a variable.
6. The __________ operator checks whether a value exists in a sequence or not.
7. The default data type of input taken using input() is __________.
8. __________ are used to store multiple values in a single variable but are
immutable.
9. The __________ operator is used to perform bitwise AND operation.
10.The __________ loop is used when the number of iterations is not known
beforehand.
11.__________ is the special character used for escaping characters in a string.
12.The Python interpreter translates source code into __________ before
execution.
13.__________ are used for conditional execution in Python.
14.In Python, indentation is used to define __________.
15.__________ is used as a placeholder when a block of code is syntactically
required but should do nothing.
16.The __________ statement can be used to exit both for and while loops.
17.To find x^y, you will use __________operator.

True or False

1. Python automatically manages memory using garbage collection.


(True/False)
2. The print() function in Python can take multiple arguments separated by
commas. (True/False)
3. In Python, 5 == 5.0 evaluates to False. (True/False)
4. A variable declared inside a function is globally accessible. (True/False)
5. continue statement in Python skips the remaining statements in the loop and
exits. (True/False)
6. The elif keyword in Python is used as an alternative to else if. (True/False)
7. The not operator in Python returns True if the expression is False.
(True/False)
8. int("10") will raise a TypeError in Python. (True/False)
9. The id() function returns the identity of an object. (True/False)
10.Python allows variable names to start with a digit. (True/False)
11.range(5) generates numbers from 0 to 5. (True/False)
12.The Python while loop runs indefinitely unless a break statement is used.
(True/False)
13.The isinstance() function checks whether an object belongs to a particular
class. (True/False)
14.The input() function always returns data as an integer. (True/False)
15.In Python, indentation plays a significant role in defining code blocks.
(True/False)

You might also like