12
12
MCQ
a. 3.9.0
b. 3.9.2
c. 3.9.4
d. 3.9.6
Answer: d
b. Dennis Ritchie
c. James Gosling
d. Bjarne Stroustrup
Answer: a
a. C Programming
b. C++ Programming
c. Java Programming
d. None of above
Answer: a
a. Artificial Intelligence
b. Machine Learning
c. Deep Learning
d. All of above
Answer: d
a. 1990
b. 1991
c. 1992
d. 1993
Answer: b
a. 1st
b. First
c. Position1
d. Rank1
Answer: a
a. For
b. IF
c. Return
d. All of these.
Answer: d
2**3**2
a. 64
b. 256
c. 512
d. 12
Answer: c
a. ?
b. <
c. **
d. and
Answer:c
a. eval
b. assert
c. nonlocal
d. pass
Answer: a
a. List
b. Dictionary
c. Tuple
d. Class
Answer: d
A%B//A
a. 0.0
b. 0
c. 0.1
d. 1.0
Answer: b
14. Which among the following list of operators has the highest precedence ?
a. <<, >>
b. **
c. |
d. %
Answer: b
a. float('12')
b. int('12')
c. float('12.5')
d. int('12.5')
Answer: d
a. /
b. //
c. #
d. !
Answer: c
17. Which of the following statements is correct regarding the Object-Oriented Programming
concept in
Python ?
Answer: b
a. x^y
b. x**y
c. x*y
d. None of these
Answer: c
x = 123
for i in x:
print(i)
a. 1 2 3
b. 123
c. Infinite loop
d. Error
Answer: d
3+3.00, 3**3.0
a. (6.0, 27.0)
b. (6.0, 9.00)
c. (6, 27)
d. [6.0, 27.0]
e. [6, 27]
Answer: a
22. Which of the following Pythons functions id used to iterate over a sequence of numbers by
specifying
a. range()
b. len()
c. substring()
d. random()
Answer: a
a. 33
b. 4
c. 32
d. 35
Answer: a
a. Dynamic
b. Static
c. Text
Answer: a
Answer: a
a. List
b. Dictionary
c. Tuple
d. Both a and b
Answer: d
b. Does nothing
Answer: c
a. Yes
b. No
c. Machine dependant
Answer: a
a. 31
b. 63
c. 78
Answer: d
30. ________ are additional readable information to clarify the statement in Python.
a. Comments
b. Expressions
c. Tokens
d. Flow of control
Answer: a
31. Which of the following literals has either True or False value ?
a. Special literals
b. Boolean literals
c. Numeric literals
d. String literals
Answer: b
x = int(13.25+4/2)
a. 15.0
b. 14
c. 15
Answer: c
a. Keyword
b. Identifier
c. Literal
d. Punctuator
Answer: a
a. False
b. True
c. Error
Answer: b
a. Names
b. Atomic unit
c. Lexical unit
d. Literals
Answer: c
a. Keyword
b. Token
c. Identifier
d. Literal
Answer: b
a. Comment
b. Identifier
c. Literal
d. Keyword
Answer: a
38. _________ is a word having a special meaning reserved by the programming language.
a. Identifier
b. Operator
c. Keyword
d. Boolean
Answer: c
a. Tokens
b. Strings
c. Literals
d. Identifiers
Answer: d
c. Operand
d. Inverted
Answer: a
a. break
b. continue
c. pass
d. None of the above
Answer: b
42. What will be the return value of the function calls given below ?
float('1e-003')
float('2e+003')
Answer: c
a. ord()
b. min()
c. chr()
d. type()
Answer: c
a. .python
b. .pe
c. .py
d. .pi
Answer: c
a. Python evaluates the second argument only if the first one is False
b. Python evaluates the second argument only if the first one is True
Answer: b
b. x y z = 10 100 1000
c. x, y, z = 10, 100, 1000
Answer: c
47. The octal literal and hexadecimal literals start with which of the following symbols respectively ?
a. O0 and X0
b. 0O and 0X
d. 0o and 0x
Answer: d
a = None
print(a+1)
a. Syntax Error
b. Type Error
c. Value Error
d. Name Error
Answer: b
a=1
z = a+a-a*a/a//a%a**a
print(z)
a. 1
b. 1.0
c. 2.0
Answer: c
0.1+0.2 == 0.3
a. True
b. False
c. Machine dependant
d. Error
Answer: b
a. if a>=2:
b. if (a>=2)
c. if (a=>22):
d. if a>=22
Answer: a
b. for i in range(0, 5)
d. for i in range(5)
Answer: c
x = "abcdef"
i = "i"
while i in x:
print(i, end="")
a. a b c d e f
b. abcdef
c. i i i i …
d. No output
Answer: d
a. Syntax error
b. Semantic error
c. Both a and b
d. None of these
Answer: c
Answer : D
Explanation: All of the above options are correct regarding variables in Python.
a. /
b. ==
c. is
d. <<
Answer: b
a. \
b. \t
c. \oo
d. \n
Answer: d
a = 547
while a > 0:
a = a//10
print(a)
a. 547
b. 547 54 5
c. 54 5 0
d. No output
Answer: c
import math
print(math.floor(1.99999999999999999999))
a. 1
b. 2
c. 1.0
d. 2.0
Answer : b
A. a>b or b>c
Answer: c
x % y // x, if x = 5, y = 4
A. 1.0
B. 0.0
C. 0
D. 1
Answer: c
Correct answer- d
c. You can write multi-line comments in Python using triple quotes, either ''' or """.
Correct answer - d
64.Is it possible to check for more than one error in one except line?
Correct answer - a
a. Open
b. lambda
c. is
d. except
a. Uppercase
b. Lowercase
d. CamelCase
Correct answer - c
a. Yes
b. No
c. machine dependent
Correct answer - a
68. Why are local variable names beginning with an underscore discouraged?
Ans : B
Explanation: local variable names beginning with an underscore discouraged because they are used
to
a. _var = 'python'
b. __var = 'python'
c. _name_ = 'python'
Correct answer - d
a. x = y
b. x ^= y ^= x ^= y
c. x, y = y, x
d. (x ^= y), (y ^= x), (x ^= y)
Correct answer - c
a. num = 1,000,000
b. x y z = 1 2 3
c. x,y,z = 1, 2, 3
d. x_y_z = 1,000,000
Correct answer - b
a. 3.2
b ) 3+.2
c ) Python 3.2
d) Shows Error
Correct answer - c
73.Which of the following statements assigns the value 100 to the variable x in Python:
a. let x = 100
b. x := 100
c. x ← 100
d. x = 100
Correct answer - d
a. a = 2 + 3j
b. a = complex(2, 3)
c. a = 2 + 3l
d. a = 2 + 3J
Correct answer - c
a) True
b) False
Correct answer - a
a. 1.0
b. 2.0
c. 0.0
d. 0
Answer- d
A. Parenthesis
B. Indentation
C. Curly braces
Answer : B
Explanation: Python uses indentation to define block of code. Indentations are simply Blank spaces
or
Tabs which is used as an indicator that indented code is the child part. As curlybraces are used in
a) round(655.8)
b) round(902.898,8,10)
c) round()
d) round(763.12,2,2.1)
Answer: a
float(22//3+3/3)
a) 8
b) 8.0
c) 8.3
d) 8.33
Answer: b
a) True
b) False
c)Error
d)None
Answer: b
81. Give the output of following with justification. [CBSE SQP 2015]
x=3
x+ = x-x
print x
Answer: 3
Working :
x=3
x = "diya"
i = "a"
while i in x:
a) no output
b) None
c) Infinite loop(a a a…….)
d) a b c d e f
Answer: c
A. if a>=2 :
B. if (a >= 2)
C. if (a => 22)
D. if a >= 22
Answer : A
Explanation: If statment always ended with colon (:). So, option A is correct.
84. What keyword would you use to add an alternative condition to an if statement?
A. else if
B. elseif
C. elif
Answer: C
Explanation: elif is used to add an alternative condition to an if statement. So, option C is correct.
A. Yes
B. No
Answer: A
Explanation: Yes, we can write if/else in one line. For eg i = 5 if a > 7 else 0. So, option A is correct.
C. Dictates what happens before the program starts and after it terminates
Answer : B
Explanation: Control structures determine which statements in the program will be executed and in
what
order, allowing for statements to be skipped over or executed repeatedly. So, option B is correct.
A. pq
B. rs
C. pqrs
D. pq12
Answer : A
A. if a = b:
B. if a == b:
C. if a === c:
D. if a == b
Answer : B
A. True
B. False
Answer : B
Explanation: Python does not have switch case statement. So, option B is correct.
A. for loop
B. while loop
C. do-while loop
Answer : C
Explanation: do-while loop is not used as loop in Python.
a=0
b=5
x=(a&b)|(a&a)|(a|b)
print("x")
A. 1
B. 5
C. 0
Answer : D
Explanation: Output of the following python code x. Therefore output is none of the above.
if False:
elif True:
else:
A. inside if block
D. Error
Answer : B
Explanation: Output of the following python code is inside elif block. Therefore Option B is correct.
A. i, ii
B. i, iv
C. ii, iii
D. ii, iv
Answer : B
Explanation: Python is a high level programming language and Python program is compiled before it
is
A. shaurya_1
B. shaurya1
C. @shaurya
D. _shaurya
Answer : C
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
Answer: C
Explanation: The Output for the following code is 0. So, Option C is correct.
96. 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
Answer : D
Explanation: The Output for the following code is 4. So, Option D is correct.
A. >=
B. <=
C. =
D. !=
Answer : C
C. True if the elements in A when compared are less than the elements in B.
Answer : B
Explanation: If A is proper subset of B then hence all elements of A are in B but B contains at least
one
A. package
B. module
C. directory
View Answer
Ans : B
Explanation: python file with .py extension called module. So, Option B is correct.
D. It returns the index position of first occurance of "m" in the string str1.
Answer : D