Python questions
Python questions
B. print("Hello, World!")
C. console.log("Hello, World!")
D. printf("Hello, World!")
Answer: B
A. .py
B. .python
C. .pt
D. .txt
Answer: A
A. for
B. while
C. loop
D. if
Answer: C
B. Interactive Mode
C. Batch Mode
D. Command Mode
Answer: B
A. 1variable
B. variable_1
C. variable-1
D. variable 1
Answer: B
A. Hello + World
B. Hello World
C. HelloWorld
D. Error
Answer: C
A. +
B. #
C. ;
D. .
Answer: D
A. Integer
B. Float
C. String
D. Boolean
Answer: C
A. To define a function
B. To indicate a comment
C. To start a loop
D. To terminate a statement
Answer: B
A. int a = 10
B. var a = 10
C. a = 10
D. declare a = 10
Answer: C
---
Medium (5 Questions):
a=5
b = "5"
print(a + int(b))
A. 55
B. 10
C. 5 5
D. Error
Answer: B
12. What is the correct way to execute a Python script in the command line?
A. python script.py
B. run script.py
C. execute script.py
D. start script.py
Answer: A
A. Keyword
B. Identifier
C. Operator
D. Library
Answer: D
x = 10
y=x
x = 20
print(y)
A. 10
B. 20
C. 30
D. Error
Answer: A
A. r-value
B. l-value
C. Constant
D. Operator
Answer: B
---
Hard (5 Questions):
x = 10
y = "20"
print(x + y)
A. 30
B. 1020
C. Error
D. None
Answer: C
A. var1
B. _variable
C. 2var
D. var_2
Answer: C
a = "Hello"
print(a[1])
A. H
B. e
C. l
D. Error
Answer: B
19. Which of the following statements is true regarding the interactive mode and script mode
in Python?
A. Script mode is used for testing code line by line.
Answer: C
x=5
y = 10
print(x == y)
A. True
B. False
C. None
D. Error
Answer: B