0% found this document useful (0 votes)
109 views24 pages

CS Grade XI One Marks-3

Uploaded by

kishoretvis3
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)
109 views24 pages

CS Grade XI One Marks-3

Uploaded by

kishoretvis3
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/ 24

1

Ponneri

Grade: XI Subject: Computer Science


Part A
1. Getting started with python
1) Which of the following is not involved in problem-solving?
a) Create a plan b) Analyzing a problem
c) Coding d) Testing and Debugging
2) Which of the following is the building block of a computer program?
a) Pseudo code b) Algorithm c) Problem d) Debugging
3) What is the other name of an Algorithm?
a) Mapping b) Sequence c) Road map d) Flow Chart
4) ______ is the pictorial representation of an algorithm.
a) Flow chart b) Problem
c) Designing d) Decision-making
5) Which symbol shows connection between different parts of the code in flow chart?
a) Oval b) Diamond c) Arrows d) Parallelograms
6) Which symbol shows processes in flow chart?
a) Rectangle b) Diamond c) Arrows d) Parallelograms
7) Which of the following symbol shows Decision or Condition in flow chart?
a) Rectangle b) Diamond c) Arrows d) Parallelograms
8) Which of the following symbol shows Input/output in flow chart?
a) Rectangle b) Diamond c) Parallelograms d) Arrows
9) _______ is an informal approach to solve a problem.
a) Algorithm b) Pseudocode c) Flow chart d) All of these
10) The process of breaking down a complex problem into smaller one is called _____
a) Composition b) Splitting c) Compression d) Decomposition

27 May 2024
11) Who developed python?
a) Dennis Ritchie b) Guido van Rossum c) Bjarne Stroustrup d) James Gosling
12) ____ indicates that it is waiting for a user command to be entered.
a) >>> b) << c) >>> d) >
13) Which of the following function converts the argument into string before writing to the screen?
a) print() b) input() c) read() d) write()

The Velammal International School, Ponneri


2
14) ___ is the default value of separator argument in the output.
a) , b) # c) Tab d) Blank space
15) ____ is the default value of end argument in the output.
a) \r b) \! c) \n d) /n
16) Find the output of the following code. print(‘one’, ‘two’, sep=’#’, end=”$”)
a) one#two$ b) one# c) one#$two#$ d) one#$
two#$ two#$
17) In which year was the Python language developed?
a) 1995 b) 1972 c) 1981 d) 1991
18) Python is a _____ Language
a) Compiled b) Interpreted
c) Compiled cum Interpreted d) None of these
19) _____ mode of python works like a calculator.
a) Interactive b) Script c) Safe d) All of these
20) _____ refers to the code is available on the internet and it can used and modified at free of cost.
a) Freeware b) Open source c) Shareware d) Proprietary
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A
iii) A is true but R is false
iv) A is false but R is true
21) Assertion(A): Python is platform-independent
Reasoning(R): Python is an interactive, interpreted and object- oriented programming language.
i) Both A and R are true and R is the correct explanation of A
22) Assertion(A): Python is a case-sensitive language
Reasoning(R): Python doesn’t differentiate between capital and small alphabets.
iii) A is true but R is false
23) Assertion(A): Python’s print function comes with the parameters end and sep
Reasoning(R): The programmers can ignore end and sep parameters in the print function
i) Both A and R are true and R is the correct explanation of A
24) Assertion(A): Python is a interpreted language
Reasoning(R): Interpreter translates the entire program line by line.
i) Both A and R are true and R is the correct explanation of A
25) Assertion(A): Python programs can be written in two modes
Reasoning(R): Scrip mode is used to store the programs for future reference
i) Both A and R are true and R is the correct explanation of A

The Velammal International School, Ponneri


3
2. Python Programming Fundamentals
1) ____ is the smallest unit of a python script.
a) Object b) Character c) Token d) Digit
2) The only special character allowed in the identifier is ___
a) @ b) _ c) ~ d) &
3) Which of the following is invalid identifier?
a) FILE13 b) _Check_Disk c) My.file d) Z02TM
4) Which of the following is valid identifier?
a) File 13 b) x12y c) My$file d) abc,
5) Special meaning words of Pythons, fixed for specific functionality are called______
a) Keywords b) Identifier c) Functions d) Literals
6) Which of the following is a keyword?
a) name b) Print c) pass d) watch
7) Which of the following is correct way to represent a string literal in python ?
a) \Monish\ b) “Monish” c) ‘/Monish’ d) “Monish’
8) Which of the following in not a literal?
a) Akash b) 456.34 c) 2354 d) “India is Great”
9) ____ is a symbol or a word that performs some kind of operation on given values.
a) Identifiers b) Keywords c) Operators d) Literals
10) ____ is a symbol which can be used as separators of variables.
a) Identifiers b) Keywords c) Operators d) Delimiters
11) Identify the category of “hello123” from the following.
a) Literal b) Operator c) Variable d) Delimiter
12) ____ returns the identity of an object.
a) type() b) id() c) int() d) print()
13) ____ is like a container that stores values.
a) Variable b) Keywords c) Numeric literals d) Constant
14) Which of the following is a component of a variable?
a) Identity b) Type c) Value d) All of these
15) ____ refers to the identity of the object.
a) Value b) Address c) Memory d) None of these
16) Which of the following is not a legal integer type value in python?
a) Decimal b) Octal c) Hexadecimal d) Roman
17) Which of the following function return you the data type of the variable in python?
a) caste( ) b) type() c) int() d) dtype( )
18) Which of the following is not a core data type in python?
a) Lists b) Dictionaries c) Class d) Tuples

The Velammal International School, Ponneri


4
19) What is the maximum length of integer in python?
a) 32 b) 16 c) 8 d) Any length
20) Which of the following represents only two possible values?
a) Int b) Complex c) Boolean d) List
21) The Boolean True value is _____
a) Non-zero b) Non-null c) Non-empty d) All of these
22) ___ is a sequence of characters that can be a combination of letters, numbers and special symbol.
a) List b) String c) Tuple d) Dictionary
23) Which of the following is used to enclose a string literal?
a) ‘ b) “ c) ’’’ d) All of these
24) ____ Characters are represented through escape sequence.
a) Non-graphic b) Graphic c) ASCII d) Unicode
25) Identity the dictionary from the following.
a) [10,22,33] b) (12, “hh”, 5) c) {1:”one”} d) 5, 6, 7
26) Which data type of used to signify the absence of value/condition?
a) None b) Null c) Slice d) Mapping
27) Find out the output of the following code?
n=3.51
print(type(n))
a) <class ‘int’> b) <class ‘float’>
c) <class ‘string’> d) <class ‘complex’>
28) ___ Symbol is used to bind a value to a variable.
a) = b) == c) + d) >>>
29) Which of the following is valid?
a) a, b, c=10, 20, 30 b) a=b=c=10 c) a=10 d) All of these
30) Which of the following cannot be used in variable name?
a) Letters b) Digits c) % d) _
31) Identify the mutable objects.
a) List b) Dictionary c) Set d) All of these
32) Identify the immutable objects.
a) int b) float c) String d) All of these
33) Find the odd one
a) bool b) List c) Tuple d) Complex

The Velammal International School, Ponneri


5
28 May 2024
34) ____ is a combination of constant, variable and operators.
a) Keyword b) Expression c) Function d) List
35) The expression 8/4/2 will evaluate equivalent to which of the following expression :
a) 8/(4/2) b) (8/4)/2 c) Wrong expression d) None of these
36) In the python statement x = a +5-b : and b are ______
a) Operands b) Operators c) Expression d) Equations
37) The process of converting the value from one data type to another is known as _____
a) Conversion b) Type conversion c) Expression d) Evaluation
38) Which of the following expression results in an error?
a) float(‘15’) b) int(.87) c) float(‘98.35K’) d) str(2358)
39) What is the value of x? x = int (13.25 +4/2)
a) 17 b) 14 c) 15 d) 23
40) Which of the following is valid arithmetic operator in python?
a) // b) ? c) < d) and
41) How would you write xy in Python as an expression?
a) x^^y b) x*y c) xy d) x ** y
42) Evaluate the following expression. 6*3+4**2//5-8
13
43) Evaluate the following expression. 10>5 and 7>12 or not 18>3
False
44) Evaluate the following expression. ((-33/13)*(35%-2)*15/3)
15.0
45) Which operator is used to compare the objects if both the operands are actually the same and share the
same memory?
a) in b) not in c) is d) is not
46) Which one of these is floor division?
a) / b) // c) % d) None of these
47) Operators with the same precedence (except power operator) are evaluated in which manner?
a) Left to Right b) Right to Left c) Any Direction d) None of these
48) To convert the read value through input( ) into integer type, ____() function is used :
a) floating b) int c) integer d) float
49) Which keyword is used to define a function?
a) fun b) int c) define d) def
50) What is the maximum line length in python program?
a) 62 b) 79 c) 50 d) Not fixed
51) Which symbol is used to create comments in python?
a) # b) ‘ c) : d) $

The Velammal International School, Ponneri


6
52) Which of the following is syntax error?
a) Incorrect indentation b) Misspelling a keyword
c) Leaving out a symbol d) All of these
53) _____ error occurs due to incorrect format of a python statement.
a) Run-time Error b) Syntax Error c) Logical Errors d) All of these
54) Which of the following is run-time error?
a) Incorrect indentation b) Incompatible types c) Division by Zero d) Division by one
55) ____ error does not stop program execution.
a) Run-time Error b) Syntax Error c) Logical Errors d) All of these
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A
iii) A is true but R is false
iv) A is false but R is true
56) Assertion(A): L-value represents an object that occupies some identifiable address in memory
Reasoning(R): There can be any valid expression on the right-hand side of the assignment operator.
ii) Both A and R are true but R is not the correct explanation of A
57) Assertion(A): A python keyword cannot be used as a variable name
Reasoning(R): Keywords are reserved words for specific purpose
i) Both A and R are true and R is the correct explanation of A
58) Assertion (A): ‘in’ operator returns True if a substring exists in the given string.
Reasoning(R): ‘in’ is identity operator
iii) A is true but R is false
59) Assertion (A): Comments are non-executable statements that are ignored by the interpreter.
Reasoning(R): Comments are used to give small description about the code.
i) Both A and R are true and R is the correct explanation of A
60) Assertion(A): List, Tuple, Dictionary are sequences
Reasoning(R): Sequences are mutable
iii) A is true but R is false

The Velammal International School, Ponneri


7
3. Conditional and Iterative Constructs
1) Which is an empty statement in python?
a) empty b) go c) pass d) leave
2) Which one of the following is a valid Python if statement?
a) if a>=2 : b) if (a >= 2) c) if (a => 22) d) if a >= 22
3) Which of following is not a decision-making statement?
a) if-elif statement b) for statement c) if -else statement d) if
4) What does the following code print to console?
if True:
print(1001)
else:
print(2002)
a) 1001 b) true c) 2002 d) false
5) ____ statement comprises a group of statements.
a) Empty b) Simple c) Compound d) All of these
6) Find the output
if 4+5==10:
print(“TRUE”)
else:
print(“false”)
print (“True”)
a) False b) True c) false d) TRUE
True True
7) What keyword would you use to add an alternative condition to an if statement?
a) else if b) elseif c) elif d) None of these
8) Predict the output of the following code:
x=3
if x>2 or x<5 and x==6:
print(“ok”)
else:
print(“no output”)
a) ok b) okok c) no output d) None of these
9) Predict the output of the following code:
x,y=2,4
if(x+y= =10):
print(“true”)
else:

The Velammal International School, Ponneri


8
print(“false”)
a) true b) false c) no output d) None of these
10) Consider the following code segment:
a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))
if a <= 0:
b = b +1
else:
a=a+1
if a > 0 and b > 0:
print ("W")
elif a > 0:
print("X")
if b > 0:
print("Y")
else:
print("Z")
What letters will be printed if the user enters -1 for a and -1 for b?
a) Only W b) Only X c) Only Y d) Only Z
11) If the user inputs : 2<ENTER>, what does the following code snippet print?
x = float(input())
if x==1:
print("Yes")
elif x >= 2:
print("Maybe")
else:
print ("No")
a) Yes b) No c) Maybe d) No output
12) ____ is a process of declaring a statement or a set of statements as a block.
a) Looping b) Indentation c) Selection d) Sequence
13) a=0
if (a):
print(“a is non-zero”)
else:
print(“its result is True”)
a) False b) True c) Its result is True d) a is non-zero
14) The____ clause can occur with an if as well as with loops.
a) else b) break c) continue d) None of these

The Velammal International School, Ponneri


9
15) The ______ statement terminates the execution of the whole loop.
a) continue b) exit c) break d) pass
16) The _____ operator tests if a given value is contained in a sequence or not.
a) In b) in c) not in d) none
17) The order of statement execution in the form of top to bottom is known as construct.
a) Alternate b) Sequence c) Flow of data d) Flow chart
18) Name is rohit and age between 18 and 35
a) name==rohit and age >=18 and age<=35 b) name==rohit and age >=18 or age<=35
c) name==rohit or age >=18 and age<=35 d) None of these
19) The for loop in Python is an _____________
a) Entry Controlled Loop b) Exit Controlled Loop
c) Both of the above d) None of these
20) A loop block in python starts with a –
a) ; (semicolon) b) , (comma) c) : (colon) d) # (hash)
21) Which of the following loop is not supported by the python programming language?
a) for loop b) while loop c) do…while loop d) None of these
22) Code repeated / looped until a condition has been met or a set number of times.
a) Sequence b) Iteration c) Selection d) Variable
23) To access a list which contains ten elements, which of the following uses of range() would produce a list
of the desired indexes?
a) range(1,10) b) range(0,9) c) range(10) d) range(1,11)
24) Write the output of the following Python code:
for i in range(2,7,2):
print(i * '$')
a) 2$ b) $$ c) 2$4$6$ d) None of these
4$ $$$$
6$ $$$$$$
25) How would you create a loop to iterate over the contents of the list given as?
monthDays = [31,28,31,30,31,30,31,31,30,31,30,31] and print out each element?
a) for days in range(monthDays): b) for days in monthDays:
print(days) print(days)
c) for days in range(len(monthDays)): d) for days in monthDays[0]:
print(days) print(days)
26) Find and write the output of the following python code:
x = "abcdef"
i = "a"
while i in x:
print(i, end = " ")

The Velammal International School, Ponneri


10
a) a b) a a a a a a
c) a a a a a a … infinite times d) Code will generate error
27) Find the output of the following program segments:
a = 110
while a > 100:
print(a, end=’#’)
a –= 2
a) 110#108#106#104#102#100# b) 110#108#106#104#102
c) 110#108#106#104#102# d) None of the above
28) Find the output of the following program segments:
for x in range(1,4):
for y in range(2,5):
if x * y > 6:
break
print (x * y)

a) 2 b) 2 c) 2 d) None of These
3 3 3
4 4 4
4 4 4
6 6 6
6 8 8
6 6
9 9
12
29) The break and continue statements, together are called _____ statement.
a) Jump b) goto c) Compound d) None of these

The Velammal International School, Ponneri


11
29 May 2024
30) range(3) in Python is equivalent to:
a) range(0,3,1) b) range(1,4,1) c) range(1,3) d) range(1,3,0)
31) Which of the following call to range() in Python will not yield anything?
a) range(-5, -1) b) range(-1, -5, -1) c) range(-5) d) All of the above
32) What will be the output of the given program segment?
for I in range(10, 1, 1):
print(I)
print(I)
a) 10 b) 9 c) Error d) None of these
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A
iii) A is true but R is false
iv) A is false but R is true
33) Assertion(A): if…elif….else statement allows you to check for multiple test expressions and execute
different codes for more than two conditions.
Reasoning(R): We can have if…elif…else statement inside another if…else statement
ii) Both A and R are true and R is not the correct explanation of A
34) Assertion(A): While loops are also called indefinite loops
Reasoning(R): Statements are executed until a logical condition remains true
i) Both A and R are true and R is the correct explanation of A
35) Assertion(A): else statement of mandatory in for loop
Reasoning(R): else is executed when loop is terminated naturally
iv) A is false but R is true
36) Assertion (A): Nested loop is one loop inside another loop.
Reasoning(R): The inner loop must have a same counter variable of its outer loop
iii) A is true but R is false
37) Assertion(A): break statement terminates the inner and outer loops simultaneously
Reasoning(R): It executes next statement immediately after the end of that loop
iv) A is false but R is true
38) Assertion (A): The range () method is used with both for and while loops.
Reasoning(R): By default, in range () function, the values for start and step are 0 and 1 respectively
iv) A is false but R is true

The Velammal International School, Ponneri


12
4. Strings in python
1) Sequence of characters, which are surrounded by quotes, is called
a) Loop b) List c) Strings d) Tuple
2) Which of the following is not a python legal string operation?
a) ‘xyz’+’xyz’ b) ‘xyz’*3 c) ‘xyz’+5 d) ‘xyz’.lower()
3) To concatenate means____
a) Replicate b) Join c) Split d) Multiply
4) What is the output of the following code?
example = "snow world"
example[3] = 's'
print (example)
a) snow b) snow world c) Error d) snos world
5) What will be the output of the following programming code?
x=”AmaZing”
print(x[3:],”and”,x[:2])
a) Amazing and ZI b) aZing and Zin c) Zing and Am d) Azing and zin
6) The______ function returns the exact copy of the string with the first letter in uppercase
a) find() b) copy() c) upper() d) capitalize()
7) How many times is the word “HELLO” printed in the following statement?
s=’python rocks’
for ch in s[3:8]:
print(‘Hello’ )
a) 6 b) 5 c) infinite d) 8
8) Find the output of the following
word=”green vegetables”
print(word.find(‘veg’,2))
a) 8 b) 6 c) 10 d) 12
9) Given a string example=”hello”
What is the output of example.count(‘l’)
a) 2 b) 1 c) None d) 0
10) What is the output of the following code?
example="helloworld"
example[::-1].startswith("d")
a) dlrowolleh b) True c) -1 d) None
11) What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', 2, 11))
a) 2 b) 0 c) 1 d) error

The Velammal International School, Ponneri


13
12) What will be the output of the following code
Msg="CompuTer"
Msg1=''
for i in range(0, len(Msg)):
if Msg[i].isupper():
Msg1=Msg1+Msg[i].lower()
elif i%2==0:
Msg1=Msg1+'*'
else:
Msg1=Msg1+Msg[i].upper()
print(Msg1)
a) cO*P*t*R b) Co*p*t*R c) co*p*t*r d) cOP*tR
13) What is the output of the following?
print("xyyzxyzxzxyy".endswith("xyy"))
a) 1 b) True c) 3 d) 2
14) What is the output of the following?
print('ab12'.isalnum())
a) True b) False c) None d) Error
15) What is the output of the following?
print('a B'.isalpha())
a) True b) False c) None d) Error
16) What is the output of the following?
print('abcdef12'.replace('cd', '12'))
a) ab12ef12 b) abcdef12 c) ab12efcd d) None of these
17) What is the output of the following?
print('abcdefcdghcd'.split('cd'))
a) [‘ab’, ‘ef’, ‘gh’]. b) ['ab', 'ef', 'gh', '']
c) (‘ab’, ‘ef’, ‘gh’) d) (‘ab’, ‘ef’, ‘gh’, ”)
18) What is the output of the following?
print('abcdefcdghcd'.split('cd', 0))
a) [‘abcdefcdghcd’] b) ‘abcdefcdghcd’
c) error d) (‘ab’, ‘ef’, ‘gh’, ”)
19) myTuple = ("Joe", "Peter", "Vicky")
x = "#".join(myTuple)
print(x)
will produce output
a) Joe#Peter#Vicky b) #JoePeterVicky
c) JoePeterVicky d) JohnPete#Vicky#

The Velammal International School, Ponneri


14
20) What is the output of the following?
print('Ab!2'.swapcase())
a) AB!@ b) ab12 c) aB!2 d) aB1@
21) What is the output of the following?
print('ab cd ef'.title())
a) Ab cd ef b) Ab cd eF c) Ab Cd Ef d) None of these
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A
iii) A is true but R is false
iv) A is false but R is true
22) Assertion (A) :
b = "Hello, World!"
print(b[:5])
will give output “Hello”
Reasoning (R): This will get the characters from start position (5 not included)
i) Both A and R are true and R is the correct explanation of A
23) Assertion (A): As we know that strings are immutable. We cannot delete or remove the characters from
the string.
Reasoning (R) But we can delete the entire string using the del keyword
i) Both A and R are true and R is the correct explanation of A
24) Assertion (A):
a = "Hello"
b = "llo"
c=a-b
print(c)
This will lead to output ‘He’
Reasoning (R) : Python strings does not support - operator
iv) A is false but R is true
25) Assertion (A): You will get an error if you use double quotes inside a string that is surrounded by double
quotes: txt = "We are the so-called "Vikings" from the north."
Reasoning (R): To fix this problem, use the escape character \":
i) Both A and R are true and R is the correct explanation of A
26) Assertion(A):
str1=”Hello” and str1=”World” then print(str1*3) will give error
Reasoning (R) : * replicates the string hence correct output will be HelloHelloHello
ii) Both A and R are true but R is not the correct explanation of A

The Velammal International School, Ponneri


15
27) Assertion (A):
str1=”Hello”
str1=”World”
print(‘wo’ not in str1) will print false
Reasoning(R): not in returns true if a particular substring is not present in the specified string.
iv) A is false but R is true

4. Lists in python
1) List can contain values of these types:
a) integers b) float c) lists d) All of these
2) Which of the following function is used to add an element at the end of the list?
a) extend() b) append() c) insert() d) None of these
3) The data type list is an ordered sequence and made up of one or more elements.
a) Mutable b) Immutable c) Both a and b d) None of these
4) Which statement from the list below will create a new list?
a) new_l = [1, 2, 3, 4] b) new_l = list() c) Both a and b d) None of these
5) What will be the output of the following python code?
new_list = [‘P’,’y’,’t’,’h’,’o’,’n’]
print(len(new_list))
a) 6 b) 7 c) 8 d) 9
6) Python allows us to replicate a list using repetition operator depicted by symbol ___
a) – b b) + c) / d) *
7) We can access each element of the list or traverse a list using ___
a) For loop b) While loop c) Both a and b d) None of these
8) Returns index of the first occurrence of the element in the list. If the element is not present, ValueError
is generated.
a) insert() b) index() c) count() d) None of these
9) Function returns the element whose index is passed as parameter to this function and also removes it
from the list.
a) push() b) remove() c) pop() d) None of these

The Velammal International School, Ponneri


16
30 May 2024
10) Which of the following will create an empty list?
a) L = ( ) b) L = list(0) c) L = list() d) L = List(empty)
11) Out of the following what is the correct syntax to copy one list into another?
a) listA = listB() b) listA = listB[:]
c) listA = listB[ ]() d) listA = list[listB]
12) Which of the following will always return a list?
a) max() b) min() c) sort() d) sorted()
13) Which of the following can delete an element from a list, if its value is given?
a) pop() b) remove() c) del d) All of these
14) Which of the following searches for an element in a list and returns its index?
a) search() b) find() c) index() d) lsearch()
15) Which of the following can copy a list another list?
a) list() b) new() c) copy() d) Both a and c
16) Which of the following is a standard Python library function and not an exclusively list function?
a) append() b) remove() c) pop() d) len()
17) Which of the following can add a list of elements to a list?
a) add() b) append() c) extend() d) none of these
18) Suppose list1 is [4, 2, 2, 4, 5, 2, 1, 0], which of the following is correct syntax for slicing operation?
a) print(list1[0]) b) print(list1[:2]) c) print(list1[:-2]) d) All of these
19) What will be the output of the following python code?
new_list = “1234”
print(list(new_list))
a) [‘1’, ‘2’, ‘3’, ‘4’] b) (‘1’, ‘2’, ‘3’, ‘4’) c) {‘1’, ‘2’, ‘3’, ‘4’} d) None of these
20) What is the output when following code is executed? >>>list1 = [11, 2, 23] >>>list2 = [11, 2, 2]
>>>list1 < list2 is
a) True b) False c) Error d) None
21) To insert 5 to the third position in list1, we use which command?
a) list1.insert (3, 5) b) list1.insert(2, 5)
c) list1.add (3, 5) d) list1.append(3, 5)
22) Suppose list1 is [2, 33, 222, 14, 25], What is list1[-1] ?
a) Error b) None c) 25 d) 2
23) Suppose list1 is [1, 3, 2], What is list1 * 2 ?
a) [2, 6, 4] b) [1, 3, 2, 1, 3] c) [1, 3, 2, 1, 3, 2] d) [1, 3, 2, 3, 2, 1]
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A

The Velammal International School, Ponneri


17
iii) A is true but R is false
iv) A is false but R is true
24) Assertion (A): In python, unlike other types, you can change elements of a list in place.
Reasoning (R): Lists are mutable sequences.
i) Both A and R are true and R is the correct explanation of A
25) Assertion (A): Any comma-separated group of values creates a list.
Reasoning (R): Only a group of comma-separated values or expressions enclosed in [ ] , creates a list.
iii) A is true but R is false
26) Assertion (A): Lists and strings have similar types of indexing.
Reasoning (R): Both lists and strings have two-way indexing, forward indexing and backward indexing.
i) Both A and R are true and R is the correct explanation of A
27) Assertion (A) :Lists are similar to strings in a number of ways like indexing , slicing and accessing
individual elements.
Reasoning (R): Lists, unlike strings, are mutable.
ii) Both A and R are true but R is not the correct explanation of A
28) Assertion (A): The membership operators in and not in work in the same way on lists as they do with
strings.
Reasoning (R): Some operators work differently on strings and lists, such as + and *
iii) A is true but R is false
29) Assertion (A): A list slice is an extracted part of a list.
Reasoning (R): A list slice is a list in itself
ii) Both A and R are true but R is not the correct explanation of A

5. Tuples
1) Which of the following statements will create a tuple ?
a) tp1 = ("a", "b") b) tp1[2] = ("a", "b") c) tp1 = (3)*3 d) None of these
2) Choose the correct statement(s).
a) Both tuples and lists are immutable.
b) Tuples are immutable while lists are mutable.
c) Both tuples and lists are mutable.
d) Tuples are mutable while lists are immutable.
3) Choose the correct statement(s).
a) In Python, a tuple can contain only integers as its elements,
b) In Python, a tuple can contain only strings as its elements.
c) In Python, a tuple can contain elements of different types.
d) In Python, a tuple can contain either string or integer but not both at a time.

The Velammal International School, Ponneri


18
4) Which of the following is/are correctly declared tuple(s)?
a) a = ("Hina", "Mina", "Tina", "Nina") b) a = "Hina", "Mina", "Tina", "Nina")
c) a = ["Hina", "Mina", "Tina", "Nina"] d) a =(["Hina", "Mina", "Tina", "Nina"])
5) What will be the output of following Python code?
a) (4.8,6) b) (2,4,3,2,4,3) c) (2,2,4,4,3,3) d) Error
6) What will be the output of following Python code?
tp1 = (15,11,17,16,12)
tpl.pop(12)
print (tp1)
a) (15,11,16,12) b) (15,11,17,16) c) (15,11,17,16,12) d) Error
7) Which of the following options will not result in an error when performed on types in Python where
tp = (5, 2, 7, 0, 3) ?
a) tp [1] = 2 b) tp.append(2) c) tp1 = tp + tp d) tp.sum()
8) What will be the output of the following Python code?
tp = ( )
tp1 = tp*2
print (len (tp1))
a) 0 b) 2 c) 1 d) Error
9) What will be the output of the following Python code?
tp = (5)
tp1 = tp * 2
print (len(tp1))
a) 0 b) 2 c) 1 d) Error
10) What will be the output of the following: Python code?
tp =(5,)
tpl= tp * 2
print(len (tp1))
a) 0 b) 2 c) 1 d) Error
11) Given tp = (5, 3, 1, 9, 0). Which of the following two statements will give the same output?
i. print (tp[:-1]) ii. print (tp[0:5]) iii. print (tp[0:4]) iv. print ( tp[-4:])
a) (i), (ii) b) (ii), (iv) c) (i), (iv) d) (i), (iii)
12) What is the output of the following code?
t = (10, 20, 30, 40, 50, 50, 70)
print (t[5:-1])
a) Blank output() b) (50,70) c) (50, 50, 70) d) (50,)
13) Which of the following functions cannot be used with nested tuples?
a) index() b) count() c) max() d) sum()

The Velammal International School, Ponneri


19
14) Consider a tuple: Months = (‘Jul’, ‘Aug’, ‘Sep’).
Identify the invalid statement(s) from the given below statements:-
a) S = Months[0] b) print(Months[2])
c) Months[1] = ‘Oct’ d) LIST1 =list(Months)
15) Suppose tuple1 = (2, 33, 222, 14, 25), What is tuple1[ ::-1]?
a) [2, 33, 222, 14] b) Error
c) 25 d) [25, 14, 222, 33, 2]
16) Consider the following declaration of Record, what will be the data type of Record?
Record=(1342, “Pooja” , 45000, “Sales”)
a) List b) Tuple c) String d) Dictionary
The following questions contain two statements: Assertion and Reasoning. Each question has four choices.
Choose the most appropriate option.
i) Both A and R are true and R is the correct explanation of A
ii) Both A and R are true but R is not the correct explanation of A
iii) A is true but R is false
iv) A is false but R is true
17) Assertion (A): Tuples can be traversed using either for or while loop.
Reasoning (R): Traversing a tuple means accessing each element of a tuple.
i) Both A and R are true and R is the correct explanation of A
18) Assertion (A): In python, tuple is an immutable sequence of data
Reasoning (R): Immutable means that any change or alteration in data is mentioned in the same place.
The updated collection will use the same address for its storage.
iii) A is true but R is false
19) Assertion (A): Tuple in python is an ordered and immutable data type.
Reasoning (R): Tuples contain heterogeneous data and permit duplicate values as well.
ii) Both A and R are true but R is not the correct explanation of A

6. Dictionaries
1) Dictionaries are.................. set of elements.
a) Sorted b) Ordered c) unordered d) random
2) Which of the following will create a dictionary with given keys and a common value?
a) fromkeys() b) update () c) setdefault() d) All of these
3) What will be printed by the following statements? .
D1 = {“cat”:12,”dog”:6,”elephant”:23,”bear”:20}
print(25 in D1)
a) True b) False c) Error d) None

The Velammal International School, Ponneri


20
4) What would the following code print?
D = {‘spring’ : ‘autumn’, ‘autumn’: ’fall’, ‘fall’ : ‘spring’}
print(d[‘autumn’])
a) autumn b) fall c) spring d) Error
5) What will be the output of following Python code?
d1 = {“a” : 10, “b” : 2, “c”:3}
str1 = “ ”
for i in d1:
str1 = str1 + str(d1[i]) + “ “
str2 = str1[:-1]
print(str2[::-1])
a) 3, 2 b) 3,2,10 c) 3,2,01 d) Error
6) Dictionaries are also called _____.
a) Mappings b) Hashes c) Associative arrays d) All of these
7) Dictionaries are _____ data types of Python.
a) Mutable b) Immutable c) Simple d) All of these
8) Which of the following functions will return the key, value pairs of a dictionary?
a) keys() b) values() c) items() d) All of these
9) Which of the following can be used to delete item(s) from a dictionary?
a) del statement b) get() c) getitem() d) All of these
10) Which of the following will raise an error if the given key is not found in the dictionary?
a) del statement b) pop() c) getitem() d) All of these
11) Which of the following is correct with respect to above Python code?
d = {"a":3,"b":7}
a) a dictionary d is created. b) a and b are the keys of dictionary d.
c) 3 and 7 are the values of dictionary d. d) All of these.
12) What would the following code print?
d = {'spring': 'autum', "autumn": "fall", "fall":"spring"}
print (d["autumn"])
a) autumn b) fall c) spring d) Error
13) What is printed by the following statements?
D1 = {"cat":17, "dog":6, "elephant":23, "bear":20}
print ("dog" in D1)
a) True b) False c) Error d) None
14) What is printed by the following statements?
D1 = {"cat":17, "dog":6, "elephant":23, "bear":20}
print (25 in D1)
a) True b) False c) Error d) None

The Velammal International School, Ponneri


21

15) For Answer Click Here


16) 11. What will be the result of the following code?
17) d1 = {"abc":5,"def":6, "ghi":7}
18) print (d1[0])
(a) abc
(b) 5
(c) (“abc” : 5)
(d) Error
19) For Answer Click Here
20) 12. What will the following code do ?
21) dict = {“Phy”:94, "Che": 70, "Bio":82, "Eng":95}
22) dict.update({"Che":72,"Bio":80})
(a) It will create new dictionary as
23) dict = {"Che 72,"Bio":80} and old dict will be deleted.
24) (b) It will throw an error as dictionary cannot be updated.
25) (c) It will simply update the dictionary as
26) dict = {"Phy":94, "Che":72, "Bio":80, "Eng"95}
27) (d) It will not throw any error but it will not do any changes in dict.
28) For Answer Click Here
29) 13. What will be the result of the following code ?
30) dict = {"Jo" : 1, "Ra" : 2}
31) dict.update({"Phoebe":2})
32) print (dict)
(a) {"Jo":1,"Ra" :2, "Ph" : 2}
(b) {"Jo":1,"Ra":2}
(c) {"Jo":1,"Ph" :2}
(d) Error
33) For Answer Click Here
34) 14. Which of the following will delete key_value pair for key = "tiger" in dictionary?
35) di = {"loin" : "wild", "tiger" : "wild", "cat": "domestic" : "dog" : "domestic"}
(a) del di["tiger"]
(b) di[“tiger”].delete()
(c) delete(di.["tiger"])
(d) del(di.["tiger])
36) For Answer Click Here
37) 15. Which of the following will give error if d1 is as shown below?
38) d1 = ("a" : 1, "b":2,"c":3)

The Velammal International School, Ponneri


22
(a) print(len(d1))
(b) print(d1.get("b"))
(c) d1["a"] = 5
(d) None of these
39) For Answer Click Here
40) 16. What will be the output of the following Python code ?
41) d1 = {"a" : 10, "b" : 2, "c" : 3}
42) str1 = ""
43) for i in d1:
44) str1 = str1 + str(d1[i])+ ""
45) str2 = str1[:-1]
46) print(str2[::-1])
(a) 3, 2
(b) 3, 2, 10
(c) 3, 2, 01
(d) Error
47) For Answer Click Here
48) 17. Which of the following will add a key to the dictionary only if it does not already exist in the
dictionary?
(a) fromkeys()
(b) update()
(c) setdefault()
(d) all of these
49) For Answer Click Here
50) 18. Which of the following will create a dictionary with given keys and a common value ?
(a) fromkeys()
(b) update()
(c) setdefault()
(d) all of these
51) For Answer Click Here
52) 19. Which value is assigned to keys, if no value is specified with the fromkeys() method ?
(a) 0
(b) 1
(c) None
(d) any of these
53) For Answer Click Here
54) 20. Which of the following will raise an error if the given dictionary is empty?
(a) del statement

The Velammal International School, Ponneri


23
(b) pop()
(c) popitem()
(d) all of these
55) For Answer Click Here
56) 21. A copy of the dictionary where only the copy of the keys is created for the new dictionary, is called
_____ copy.
(a) key copy
(b) shallow copy
(c) deep copy
(d) partial copy
57) For Answer Click Here
58) 22. A copy of the dictionary where the copy of the keys as well as the values is created for the new
dictionary, is called _____ copy.
(a) key copy
(b) shallow copy
(c) deep copy
(d) partial copy
59) For Answer Click Here
60) 23. Which of the following Python codes will give the same output if
61) dict = {"diary":1, "book":3, "novel":5}
1. dict.pop("book")
2. del dict["book"]
3. dict.update({"diary":1,"novel":5})
(a) (i), (ii), (iii)
(b) (i), (ii)
(c) (i), (iii)
(d) (ii), (iii)
62) For Answer Click Here
63) 24. What will be the output of following Python code ?
64) d1 = {"a":10, "b":2, "c":3}
65) str1=""
66) for i in d1:
67) str1=strl + str(d1[i]) + " "
68) str2 = str1[:-1]
69) print (str2[::-1])
(a) 3, 2
(b) 3, 2, 10
(c) 3, 2, 01

The Velammal International School, Ponneri


24
(d) Error
70) For Answer Click Here
71) 25. Running the code sorted(my_dictionary, reverse = True) on a dictionary named my_dictionary will
return results sorted in what order ?
(a) Ascending order (A-Z), by key
(b) Ascending order (A-Z), by value
(c) Descending order (Z-A), by key
(d) Descending order (Z-A), by valu

The Velammal International School, Ponneri

You might also like