0% found this document useful (0 votes)
14 views2 pages

Review of Python -I

The document consists of a review of Python programming concepts, including true/false statements, multiple-choice questions, assertions, reasoning, and code output predictions. It covers topics such as variable declarations, data types, operators, and expressions. The document is structured to test knowledge and understanding of Python through various question formats.

Uploaded by

alockhayato97
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)
14 views2 pages

Review of Python -I

The document consists of a review of Python programming concepts, including true/false statements, multiple-choice questions, assertions, reasoning, and code output predictions. It covers topics such as variable declarations, data types, operators, and expressions. The document is structured to test knowledge and understanding of Python through various question formats.

Uploaded by

alockhayato97
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/ 2

Review of Python – I

State True or False


1. Python converts low level language to high level language.
2. Interactive mode is used when a user wants to run a single line or one block of code.
3. The expression 4**3**2 is evaluated as (4**3)**2
4. "In Python, data type of a variable depends on its value"
5. A Sequence is an ordered collection of items, indexed by integers both positive and
negative.
MCQ
1. Which of the following is not a valid declaration?
(a) S=12 (b) V="J" (c) F=32.4 (d) H=0254
2. Which of the following expressions is an example of type casting?
(a) 4.0+float(6) (b) 5.3+6.3 (c) 5.0+3 (d) None of these
3. Which of the following cannot be a variable name?
(a) _init_ (b) in (c) it (d) on
4. Which of the following is an invalid operator in Python?
(a) - (b) //= (c) in (d) =%
5. Which of the following is a valid identifier:
a) 9type b) _type c) Same-type d) True
6. What will be the correct output of the statement : >>> 4+2**2*10
a) 18 b) 80 c) 44 d) None of the above
7. Which of the following are the fundamental building block of a python program.
a) Identifier b) Constant c) Punctuators d) Tokens
8. Which of the following belongs to complex datatype (a) -12+2k (b) 4.0 (c) 3+4J (d) -2.05I
9. >>> 16 // (4 + 2) * 5 + 2**3 * 4 (a) 42 (b) 46 (c) 18 (d) 32
10. Evaluate the following expression: True and False or Not True
(a) True (b) False (c) NONE (d) NULL
11. Identify the invalid Python statement from the following.
(a) _b=1 (b) b1= 1 (c) b_=1 (d) 1 = _b
12. Predict output for following code
v1= True
v2=1
print(v1==v2, v1 is v2)
(a) True False (b) False True (c) True True (d) False False
13. Which of the following results in an error?
(a) float(“12‟) (b) int(“12‟) (c) float(‟12.5‟) (d) int(“12.5‟)
14. >>> print( ( - 33 // 13) * (35 % -2)* 15/3)
(a) 10.0 (b) -15.0 (c) 15.0 (d) -10.0
15. Evaluate the following expression: False and bool(15/5*10/2+1)
Assertion and Reasoning
1. A: Python is case-sensitive.
R: NUMBER and number are not same in Python
2. A: An identifier cannot have the same name as of a keyword.
R: Python interpreter will not be able to differentiate Between a keyword and an identifier
having the same name as of a keyword.
3. A : Age=18 print(age)
R : Variables are case sensitive
4. A: a=9, b=int(9.2) Both a and b have same value
R:b is converted to integer explicitly
5. A: In an expression, associativity is the solution to the order of evaluation of those operators
which clashes due to same precedence.
R: Operators in an expression may have equal precedence due to which the order of
evaluation cannot be decided just by precedence.
2 Marks Questions
1. Find the output generated by the following code:
a=5
b=10
a+=a+b
b*=a+b
print(a,b)
2. Write the output of the code given below:
p=10
q=20
p*=q//3
p=q**2
q+=p
print(p,q)
3. Predict the output of the following:
X=3
Y=5
Z = -2
X *= Y + Z
Y -= X * 2 + Y
Z += X + Y
print(X, Y, Z)
ii. Predict the output of the following code:
X=3
Y=2
Z = -5
X -= Y + Z
Y //= X - Z
Z *= X + Y
print(X, Y, Z)
4. Predict the output of the following:
M, N, O = 3, 8, 12
N, O, M = O+2, M*3, N-5
print(N,O,M)
5. V, W, X = 20, 15, 10
W, V, X = X-2, V+3, W*2
print(V,X,W)

You might also like