0% found this document useful (0 votes)
69 views4 pages

Current Spot 7

The document contains 25 multiple choice questions about Python programming concepts like variables, data types, operators, conditional statements, loops, and functions. The questions test knowledge of Python syntax, program execution, Boolean logic, and evaluating expressions. Correct answers are provided for self-assessment of understanding core Python programming principles covered in the questions.

Uploaded by

sakthi
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)
69 views4 pages

Current Spot 7

The document contains 25 multiple choice questions about Python programming concepts like variables, data types, operators, conditional statements, loops, and functions. The questions test knowledge of Python syntax, program execution, Boolean logic, and evaluating expressions. Correct answers are provided for self-assessment of understanding core Python programming principles covered in the questions.

Uploaded by

sakthi
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/ 4

MAHATMA GLOBAL GATEWAY

GRADE XI COMPUTER SCIENCE


CURRENT SPOT - 7

1. What will be the output of the following program on execution?


a=0
b=5
x=(a&b)|(a&a)|(a|b)
print("x")
A. 1 B. 5 C. 0 D. None of the above

2. What will be the output of the following program on execution?


if False:
print ("inside if block")
elif True:
print ("inside elif block")
else:
print ("inside else block")
A. inside if block B. inside elif block C. inside else block D. Error

3. Which of the following statements are correct?


(i) Python is a high level programming language.
(ii) Python is an interpreted language.
(iii) Python is a compiled language.
(iv) Python program is compiled before it is interpreted.
A. i, ii B. i, iv C. ii, iii D. ii, iv D. ALL THE ABOVE

4. Which of the following is incorrect variable name in Python?


A. variable_1 B. variable1 C. 1variable D. _variable

5. What will be the output of following Python code snippet?


str1="012"
num1=2
num2=0
for i in range(4):
num1+=2
for j in range(len(str1)):
num2=num2+num1
num3=num2%int(str1)
print(num3)
A. 7 B. Infinite Loop C. 0 D. Error

6. What will be the result of following Python code snippet after execution?
str1=""
i=0
var2=1
while(i<3):
var1=1
if str1:
var2=var1*var2+5
else:
var2=var1*var2+1
i=i+1
print(var2)
A. 16 B. 12 C. 11 D. 4

7. Which of the following is not a relational operator in Python?


A. >= B. <= C. = D. !=

8. What is the output of the following code?


valueOne = 5 ** 2
valueTwo = 5 ** 3
print(valueOne)
print(valueTwo)
a) 10 b) 25 c) Error invalid syntax d) Error
15 125

9. A string is immutable in Python?


a) True b) False c) not a data type d) It’s a keyword

10. What is the output of the following code?


p, q, r = 10, 20 ,30
print(p, q, r)
a) 10 20 b) 10 20 30 c) Error : invalid syntax d) 10

11. What is the output of the following code?


for i in range(10, 15, 1):
print( i, end=', ')
a) 10, 11, 12, 13, 14 b) 10, 11, 12, 13, 14, 15, c) 10,11 d) 12,13,14

12. What is the Output of the following code?


for x in range(0.5, 5.5, 0.5):
print(x)
a) [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5] c) [0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5]
b) The Program executed with errors d) none of the above

13. Which operator has higher precedence in the following list


a) Modulus (%) b) && c) ** d) >

14. x = 36 / 4 * (3 + 2) * 4 + 2
print(x)
a) 182.0 b) 37 c)182 d) The program executed with errors
15. What is the output of the following code?
var1 = 1
var2 = 2
var3 = "3"
print(var + var2 + var3)
a) 6 b) 33 c) 123d) error. Mixing operators between numbers and strings are not
supported.
16. Which of the following is not a Boolean expression?
a) True b) 3 == 4 c) 3 + 4 d) 3 + 4 == 7

17. Which of the following properly expresses the precedence of operators (using parentheses) in
the following expression: 5*3 > 10 and 4+6==11
a) ((5*3) > 10) and ((4+6) == 11) b) (5*(3 > 10)) and (4 + (6 == 11)) c) ((((5*3) > 10)
and 4)+6) == 11
d) ((5*3) > (10 and (4+6))) == 11

18. What does the following code print?


if 4 + 5 == 10:
print("TRUE")
else:
print("FALSE")
print("TRUE")
a. TRUE b. TRUE c. FALSE d. TRUE
FALSE TRUE FALSE
TRUE

19. What does the following code print?


x = -10
if x < 0:
print("The negative number ", x, " is not valid here.")
print("This is always printed")
a.This is always printed b.The negative number -10 is not valid here
This is always printed
c. The negative number -10 is not valid here d. Error

20. Which of the following is true about the code below?


x=3
if (x > 2):
x = x * 2;
if (x > 4):
x = 0;
print(x)
a) x will always equal 0 after this code executes for any value of x
b) if x is greater than 2, the value in x will be doubled after this code executes
c) if x is greater than 2, x will equal 0 after this code executes
21. Which of the following will evaluate to true?
I. True AND False
II. False or True
III. False AND (True or False)
a) I b) II c) I and II d) II and III

22. Given two variables, num1 and num2, which of the following would mean that
both num1 and num2 are positive integers?
a) (num1 == num2) b) (num1 == num2) or (num1 > 0)
c) (num1 == num2) and (num1 < 0) d) (num1 == num2) and (num1 > 0)

23. True is what type of variable?


a) float b) string c) Boolean d) integer
24.  What is the output from the following code?
a=3
b = (a != 3)
print(b)
a) True b) False c) 0 d) 3

25. Which of the following evaluates to True when a is equal to b or when a is equal to 5?
a) a == b == 5 b) a = b or a = 5 c) a == b or a == 5 d) a = b and a = 5

You might also like