1.Which of the following operators is used to perform exponentiation in Python?
A) ** B) // C) % D) /
What is the output of the following expression in Python: 5 % 3?
A) 2
B) 1
C) 3
D) 0
Which operator is used to perform floor division in Python?
A) //
B) %
C) **
D) /
What is the output of the following expression in Python: 10 / 3?
A) 3.33333333333
B) 3
C) 4
D) 3.5
Which of the following operators is used to perform bitwise OR in Python?
A) &
B) |
C) ^
D) ~
What is the output of the following expression in Python: 3 ** 3?
A) 9
B) 27
C) 81
D) 243
Which of the following operators is used to perform bitwise AND in Python?
A) &
B) |
C) ^
D) ~
What is the output of the following expression in Python: 5 + 3 * 2?
A) 16
B) 11
C) 13
D) 8
Which of the following operators is used to perform bitwise NOT in Python?
A) &
B) |
C) ^
D) ~
What is the output of the following expression in Python: 7 // 3?
A) 3
B) 2
C) 2.33333333333
D) 2.5
Indentation:
Which of the following is used for indentation in Python?
A) Curly braces {}
B) Semicolons ;
C) Spaces
D) Parentheses ()
What happens if indentation is incorrect in Python?
A) The program runs without any errors
B) The program produces incorrect output
C) The program does not run at all
D) The program runs slower
What is the standard number of spaces used for indentation in Python?
A) 2
B) 4
C) 6
D) 8
What is the purpose of indentation in Python?
A) To make the code look pretty
B) To group statements together
C) To make the code run faster
D) To make the code more secure
Which of the following statements is true about indentation in Python?
A) It is optional
B) It is mandatory
C) It is recommended but not required
D) It is used only for comments
If statement:
What is the output of the following code in Python:
if 5 > 3:
print("Hello")
else:
print("World")
A) Hello
B) World
C) Both
D) Neither
Which of the following is the correct syntax for an if statement in Python?
A) if x > 5:
B) if (x > 5)
C) if x > 5
D) if [x > 5]
What is the output of the following code in Python:
if 5 > 3:
print("Hello")
print("World")
A) Hello
B) World
C) Both
D) Neither
Which of the following is used to represent the "else if" statement in Python?
A) elif
B) elseif
For loop:
What is the output of the following code in Python:
for i in range(5):
print(i)
A) 1 2 3 4 5
B) 0 1 2 3 4
C) 1 3 5 7 9
D) 0 2 4 6 8
Which of the following is the correct syntax for a for loop in Python?
A) for (i = 0; i < 5; i++):
B) for i in range(5)
C) for i = 0 to 5
D) for i < 5 in range
What is the output of the following code in Python:
for i in range(1, 6):
if i == 3:
break
print(i)
A) 1 2 3 4 5
B) 1 2
C) 1 2 4 5
D) 1 2 3
Which of the following is used to represent an empty for loop in Python?
A) empty()
B) pass
C) null
D) empty
What is the output of the following code in Python:
for i in range(5):
if i == 2:
continue
print(i)
A) 0 1 3 4
B) 0 1 2 3 4
C) 1 3 4
D) 0 1 4 5
While loop:
What is the output of the following code in Python:
i=0
while i < 5:
print(i)
i += 1
A) 1 2 3 4 5
B) 0 1 2 3 4
C) 1 3 5 7 9
D) 0 2 4 6 8
Which of the following is the correct syntax for a while loop in Python?
A) while (i < 5):
B) while i < 5
C) while i = 5
D) while [i < 5]
What is the output of the following code in Python:
i=0
while i < 5:
if i == 3:
break
print(i)
i += 1
A) 0 1 2 3 4
B) 0 1 2
C) 0 1 2 4
D) 1 2 4
Which of the following is used to represent an empty while loop in Python?
A) empty()
B) pass
C) null
D) empty
[email protected]
pllease continue
What is the output of the following code in Python:
i=0
while i < 5:
if i == 2:
i += 1
continue
print(i)
i += 1
A) 0 1 2 3 4
B) 0 1 2
C) 0 1 3 4
D) 0 1 4
What is the output of the following code in Python:
i=0
while i < 5:
if i == 2:
break
print(i)
i += 1
A) 0 1 2 3 4
B) 0 1 2
C) 0 1 3 4
D) 0 1 4
Installing Python:
What is the official website for downloading Python?
A) https://python.com
B) https://python.org
C) https://python.net
D) https://python.info
Which of the following is a popular package manager for Python?
A) npm
B) apt-get
C) pip
D) yum
Which version of Python is recommended for beginners?
A) Python 2.x
B) Python 3.x
C) Both
D) Neither
Which of the following operating systems does not come with Python pre-installed?
A) Windows
B) Mac OS X
C) Linux
D) All of the above come with Python pre-installed
Which command is used to check the version of Python installed on your system?
A) py --version
B) python --version
C) ver
D) version
Which of the following is used to exit the Python interactive shell?
A) exit()
B) quit()
C) Both
D) Neither
Which of the following commands is used to install a Python package?
A) pip install <package name>
B) python install <package name>
C) apt-get install <package name>
D) npm install <package name>
What is the minimum required version of Python for installing and using the pip package manager?
A) Python 2.x
B) Python 3.x
C) Both
D) Neither
Which of the following commands is used to upgrade a Python package using pip?
A) pip upgrade <package name>
B) pip update <package name>
C) pip install --upgrade <package name>
D) pip install -u <package name>
What is the purpose of the virtual environment in Python?
A) To install Python packages globally
B) To create a sandboxed environment for testing and development
C) To speed up the performance of Python
D) To allow multiple versions of Python to be installed on the same system.
Operators:
A) **
B) 2
A) //
A) 3.33333333333
B) |
B) 27
A) &
D) 8
D) ~
B) 2
Indentation:
C) Spaces
B) The program produces incorrect output
B) 4
B) To group statements together
B) It is mandatory
If statement:
A) Hello
C) if x > 5
C) Both
A) elif
For loop:
B) 0 1 2 3 4
B) for i in range(5)
D) 1 2 3
B) pass
A) 0 1 3 4
While loop:
B) 0 1 2 3 4
B) while i < 5
B) 0 1 2
B) pass
C) 0 1 3 4
A) 0 1 2 3 4
Installing Python:
B) https://python.org
C) pip
B) Python 3.x
A) Windows
B) python --version
A) exit()
A) pip install <package name>
B) Python 3.x
C) pip install --upgrade <package name>
B) To create a sandboxed environment for testing and development