Python identifiers are case sensitive.
(a) True (b) False(c)Depends on Program(d)Depends on the computer system
Which of the following is an invalid identifier?
(a) CS_class_XII (b) csclass12 (c)_csclass12(d)12CS
The tiny inidividual unit in python program is known as ___________
(a) Expression (b) Statement (c) Token (d) Comment
Which of the following not a token?
(a)Comments (b)Identifiers (c) Literals (d)Operators
Which of the following are pre-defined or reserved words that convey a special meaning in programming language?
(a) Identifiers (b) Literals (c)Keywords (d) Operators
The different names given to different parts of a program is known as _________
(a) Identifiers (b) Literals(c) Keywords(d) Operators
Which of the following literals must terminate in one line?
(a) Single line Strings (b) Multi line strings (c) Numeric Literals (d)All of the above
To include non-graphic characters in python, which of the following is used?
(a) Special Literals (b)Boolean Literals (c) Escape Character Sequence (d) Special Literal – None
The octal literal and hexadecimal literals start with which of the following symbols resepctively?
(a) O0 and X0(b) 0O and 0X (c) Oct0 and Hex0 (d) 0o and 0x
Which of the following literal has either True or False value?
(a) Special Literals(b) Boolean Literals (c) Numeric Literals (d)String Literals
Which of the following are symbols used for computation or logical comparison in a program?
(a) Identifiers (b) Literals (c) Keywords (d) Operators
Which of the following is correct statement to computer square of variable x in python?
(a) x * 2 (b) x power 2 (c) x ** 2(d)x // 2
If you want to display the values without decimal place after division, which of the following symbol is used?
/ // % **
Which of the is a correct statement?
(a) xyz = 10 100 1000 (b) x y z = 10 100 1000 (c) x, y, z = 10, 100, 1000
(d) x y z= 10, 100, 1000
Which of the following are symbols used in programming languages to organize statement structures and indicate the rythm of the program?
(a) Operators (b) Punctuators (c) Functions (d) Literals
In python, the single line comments starts with _______
/ // # ”’
In python, the multiline comments starts with ________
/ // # ”’
_______ are additional readable information to clarify the statement in python.
(a)Comments (b) Expressions (c) Tokens (d) Flow of control
Which of the following is a group of statements which are part of another statement or functions?
Expression Statement Block Comment
All statements inside a block are intended at same level.
True False Not necessarily Depends on user’s choice
By default the input() function returns
(a) Integer (b) Float (c) Boolean (d)String
If a function does not return a value then what value will be returned by python in a function?
int void bool none
The output of d= a + b % c is _________, if a = 12, b=5 and c=3.
14 2 5 17
Evaluate x % y // x, if x = 5, y = 4 (Left to Right(LTR) associativity
1.0 0.0 0 1
Which of these arithmetic operator will evaluate first?
+ – ** % //
Which of these relational operator has highest operator precedence?
< >= <= ==
Which of the followiing logical operator will evaluate first?
and or not is not
How a>b>c will be interpreted by python?
a>b or a>c
a>b not a>c
a>b and a>c
a>b && a>c
Which of the following statement is correct for and operator?
Python only evaluates the second argument if the first one is False
Python only evaluates the second argument if the first one is True
Python only evaluates True if any one argument is True
Python only evaluates False if any one argument is False
Which of the following forces an expression to be converted into specific type?
implicit type casting
mutable type casting
immutable type casting
explicit type casting
_____ are stored as individual characters in contiguous locations, with two-way index for each location.
lists
tuples
strings
dictionaries
What is the output of – “5” + “5” ?
25
55
10
error
If n=”Hello” and user wants to assign n[0]=’F’ what will be the result?
It will replace the first character
It’s not allowed in Python to assign a value to individual character using index
It will replace the entire word Hello into F
It will remove H and keep rest of the characters
Which of the following operator can be used as replication operator?
+ * ** /
Which point can be considered as difference between string and list?
(a) Length (b) Indexing and Slicing (c) Mutability (d) Accessing individual elements
In list slicing, the start and stop can be given beyond limits. If it is then
reaise exception IndexError
raise exception ValueError
return elements falling between specified start and stop values
return the entire list
In list slicing negative index -1 refers to
first element
last element
second last element
second element
Which of the following operator cannot used with strings?
== + * /
Ms. Hetvee is working on a string program. She wants to display last four characters of a string object named s. Which of the following is statement is true?
s[4:]
s[:4]
s[-4:]
s[:-4]
The append() method adds an element at
first last specified index at any location
Which of the following statement is true for extend() list method?
(a) ads element at last (b) ads multiple elements at last (c) ads element at specified index
(d) ads elements at random index
The statement del l[1:3] do which of the following task?
deletes elements 2 to 4 elements from the list
deletes 2nd and 3rd element from the list
deletes 1st and 3rd element from the list
deletes 1st, 2nd and 3rd element from the list
If l=[11,22,33,44], then output of print(len(l)) will be
4 3 8 6
Which of the following method is used to delete element from the list?
del()
delete()
pop()
All of theese
What will be the output of following code:
txt="Term 1"
print(txt*2)
a) Term 1 Term 2 b) Term 1Term 1 c) Term 1 2 d) TTeerrmm 11
What will be the output of:
txt="SQP2021"
if txt.isalnum()==True:
print("Term 1 sample paper is out now")
else:
print("Term 1 sample paper is not out till now")
a) Term 1 sample paper is not out till now b) Term 1 sample paper is out now
c) SQP2021 d) Error
What will be the output of the following statement given:
txt="term 1. sample paper 2021"
print(txt.capitalize())
a) term 1. sample paper 2021 b) Term 1. Sample Saper 2021
c) Term 1. sample paper 2021 d) Term 1. Sample Paper 2021
Which of the following statement prints output as ‘B’?
a) char(66) b) ord(‘B’) c) char(66) d) chr(66)
Which of the following statement(s) is/are correct?
a) Tuples can have only integer elements. b) Tuples can have only string elements.
c) Tuples can have various types of elements.
d) Tuples can either integer or string, but not both at once.
Which of the following statement creates a tuple?
a) t=[1,,2,3,4] b) t={1,2,3,4} c) t=<1,2,3,4> d) t=(1,2,3,4)
Which of the following statement is correct?
a) Tuples are mutable. b) Tuples are immutable. c) Tuples and lists are same.
d) All of these are correct.
What will be the output of the following code:
t=(4,5,6)
t1=t*2
print(t1)
a) (4,5,6,4,5,6) b) (4,4,5,5,6,6) c) (8,10,12) d) None of the above
What will be the output of :
t=(4,5,6)
del t[1]
print(t)
a) (4,6) b) ([4,6]) c) [4,6] d) Error
Which of the following operation is supported in python with respect to tuple t?
a) t[1]=33 b) t.append(33) c) t=t+t d) t.sum()
Which of the following statements prints the output (4,5)?
print(t[:-1]) , print(t[0:2])
print(t[3]), print(t[:-3])
print(t[2:3]), print(3:2)
print(t[0,2]), print[2,3]
56. What will be the output of the following code:
t=(4,5,6,7,8,9,3,2,1)
print(t[5:-1])
a) (8,9,3,2,1)
b) (9,3,2)
c) (4,5,6,7)
d) (2,3,9)
57. Dictionaries are also known as ________.
a) mappings
b) hashes
c) associative arrays
d) all of the above
58. Dictionaries are _________ type of python.
a) Mutable
b) Immutable
c) simple
d) complex
59. Mr Subodh is working with a dictionary in python for his project. He wants to display the key, value pair but confuse out of these statements, choose the correct statement for him:
a) dict.values()
b) disct.keys()
c) dict.keysvalues()
d) dict.items()
The fromkeys() method assigns ________ value to key in dictionary by default.
a) 0 b) None c) Empty d) Blank
Which one of the following is the correct statement for creating a dictionary for assigning a day number to weekdays using short names?
a) d ={1:Mon,2:Tue,3:Wed,4:Thur}
b) d ={1:’Mon’,2:’Tue’,3:’Wed’,4:’Thur’}
c) d ={1;’Mon’,2;’Tue’,3;’Wed’,4;’Thur’}
d) d ={1-‘Mon’,2-‘Tue’,3-‘Wed’,4-‘Thur’}
Om is learning the concept of dictionary in python. He read something about a dictionary related to a set of elements. But he forgot the term which type of set of elements, suggest from the below-given options:
a) sorted b) ordered c) unordered d) random
Eshika is trying to delete an element from the dictionary, but she is getting an error – “the given key is not found in the dictionary”. Which of the following command she has used in the python
a) del dict[key] b) dict.pop(key) c) dict.popitem(key) d) remove dict[key]
Which of the following is the correct statement for checking the presence of a key in the dictionary?
a) <key> in <dictionary_object>
b) <key> not in <dictionary_object>
c) <key> found in <dictionary_object>
d) a) <key> exists in <dictionary_object>
What will be the output of the following dictionary?
d={'South Africa':'Faf Du Plesis','India':'Virat Kohli','Pakistan':'Babar Azam','Australia':'Steve Smith'}
print(d['Virat Kohli'])
a) India b) India-Virat Kohli c) Virat Kohli d) KeyError
What will be the output of the following code?
d={'South Africa':'Faf Du Plesis','India':'Virat Kohli','Pakistan':'Babar Azam','Australia':'Steve Smith'}
print("india" in d)
a) True b) False c) Error d) None
Q67. Predict the correct output for the following code:
dict={'Manthan':34,'Vishwa':45,'Mayank':50}
print(dict[0])
a) Manthan:34 b) 34 c)Manthan d) Error
Marks in the above-created dictionary are changed after rechecking, where Vishwa got 48 marks and Mayank got 49 marks. Choose the correct statement for the same:
a) dict.change({‘Vishva’:48,’Mayank’:49})
b) dict.alter({‘Vishva’:48,’Mayank’:49})
c) dict.update({‘Vishva’:48,’Mayank’:49})
d) dict.loc({‘Vishva’:48,’Mayank’:49})
What happens when the following statement will be written for the same dictionary created in Que. No. 67?
dict.update({'Sameer':44})
a) It will raise an error – KeyError
b) It will add a new key and value at the end of the dictionary
c) It will replace the last key and value with the given key and value
d) It will add a new key and value at the beginning of the dictionary
Which of the following code will print output as 3 for the dictionary created in Que. No. 67?
a) print(dict.size) b) print(size(dict)) c) print(length(dict)) d) print(len(dict))
What will be the output of the following code?
dict={'x':11,'y':13,'z':15}
s=""
for i in dict:
s=s+str(dict[i])+" "
s1=s[:-1]
print(s1[::-1])
a) 15 13 11 b) 11 13 15 c) 51 31 11 d) 10 13 14