0% found this document useful (0 votes)
46 views

CSC 201 obj test-1

The document contains a series of Python objective practice questions designed for students, covering various aspects of the Python programming language, including data types, functions, and syntax. It emphasizes that the content is not affiliated with the Federal University of Technology, Akure, and does not guarantee the accuracy of the answers provided. The questions are compiled by an individual named Olugbenga and include answers for each question.

Uploaded by

akinbodejohn2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

CSC 201 obj test-1

The document contains a series of Python objective practice questions designed for students, covering various aspects of the Python programming language, including data types, functions, and syntax. It emphasizes that the content is not affiliated with the Federal University of Technology, Akure, and does not guarantee the accuracy of the answers provided. The questions are compiled by an individual named Olugbenga and include answers for each question.

Uploaded by

akinbodejohn2004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

CSC202 PYTHON OBJECTIVE PRACTICE QUESTIONS

DISCLAIMER: THIS FILE IS NOT A PROPERTY OF THE FEDERAL UNIVERSITY OF


TECHNOLOGY, AKURE AND BY NO MEANS SUGGESTS THAT ANY OF THE QUESTIONS
THEREIN ARE TO BE EXPECTED VERBATIM IN ACADEMIC TEST CONDUCTED BY THE
SCHOOL AND WE DO NOT GUARANTEE THAT THE SOLUTIONS ARE 100% CORRECT;
NEITHER DOES IT SERVE A SUBSTITUTE FOR ANY RECOMMENDED ACADEMIC
AID/MATERIAL SUPPLIED BY THE SCHOOL. STUDENTS DISCRETION IS THEREFORE
ADVISED. (PUT TOGETHER USING PYTHON 2 SERIES).

S
ES
Q 1 - Which of the following is correct about Python?

A - Python is a high-level, interpreted, interactive and object-oriented


scripting language.
B - Python is designed to be highly readable.
CC
C - It uses English keywords frequently where as other languages use
punctuation, and it has
fewer syntactical constructions than other languages.
D - All of the above.
ANS = D
SU

Q 2 - Which of the following is correct about Python?


A - It supports functional and structured programming methods as well
as OOP.
B - It can be used as a scripting language or can be compiled to
byte-code for building large applications.
C - It provides very high-level dynamic data types and supports dynamic
type checking.
D - All of the above.
ANS = D

1
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 3 - Which of the following is correct about Python?
A - It supports automatic garbage collection.
B - It can be easily integrated with C, C++, COM, ActiveX, CORBA, and
Java.
C - Both of the above.
D - None of the above.
ANS = C

Q 4 - Which of the following environment variable for Python tells the


Python interpreter where to locate the module files imported into a
program?
A - PYTHONPATH
B - PYTHONSTARTUP

S
C - PYTHONCASEOK
D – PYTHONHOME
ES
ANS = A

Q 5 - Which of the following environment variable for Python contains


the path of an initialization file containing Python source code?
A - PYTHONPATH
CC
B - PYTHONSTARTUP
C - PYTHONCASEOK
D – PYTHONHOME
ANS = B
SU

Q 6 - Which of the following environment variable for Python is used in


Windows to instruct Python to find the first case-insensitive match in an
import statement?
A - PYTHONPATH
B - PYTHONSTARTUP
C - PYTHONCASEOK
D – PYTHONHOME
ANS = C

Q 7 - Which of the following environment variable for Python is an


2
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
alternative module search path?
A - PYTHONPATH
B - PYTHONSTARTUP
C - PYTHONCASEOK
D – PYTHONHOME
ANS = D

Q 8 - Is python a case sensitive language?


A - true
B – false
C – can’t say
D – None of the above

S
ANS = A

ES
Q 9 - Which of the following data types is not supported in python?
A - Numbers
B - String
C - List
CC
D – Slice
ANS = D

Q 10 - Which of the following data types is not supported in python?


SU

A - Tuple
B - Dictionary
C - Generics
D – List
ANS = C

Q 11 - What is the output of print str if str = 'Hello World!'?


A - Hello World!
B - Error
C - str
D - None of the above.
3
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
ANS = A

Q 12 - What is the output of print str[0] if str = 'Hello World!'?


A - Hello World!
B-H
C - ello World!
D - None of the above.
ANS = B

Q 13 - What is the output of print str[2:5] if str = 'Hello World!'?


A - llo World!

S
B-H
C - llo
ES
D - None of the above.
ANS = C

Q 14 - What is the output of print str[2:] if str = 'Hello World!'?


CC
A - llo World!
B-H
C - llo
D - None of the above.
ANS = A
SU

Q 15 - What is the output of print str * 2 if str = 'Hello World!'?


A - Hello World!Hello World!
B - Hello World! * 2
C - Hello World!
D - None of the above.
ANS = A

Q 16 - What is the output of print job[-9] if job = “School Call”?


A-c
B–h
4
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
C–o
D – Error
ANS = B

Q 17- What is the output of print job[-3] + job[-6] if job = “school call”?
A-c
B – co
C – al
D – Error
ANS = C

Q 18 - What is the output of print dept[16:3:-1] if dept = 'computer


science'?

S
A – ecneics retu
B – p cpe see
ES
C – syntax error
D - mpu
ANS = A

Q 19 - What is the output of print dept[0:16:3] if dept = 'computer


CC
science'?
A – pesee
B – p cpe see
C – syntax error
D - cpesee
SU

ANS = D

Q 20 – if s = (“---A biro is a pen; but not all pens are biros---”). What is the
output of s.find(‘are’)?
A – 35
B – 37
C – 38
D–1
ANS = B

Q 21 - if s = (“---A biro is a pen; but not all pens are biros---”). What is the
output of s.count(‘but’)?
5
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
A – 20
B – 21
C–1
D – 11
ANS = C

Q 22 - x = (“Federal University of Technology, Akure”). What is the output


of len(x)?
A – 38
B – 37
C – 39
D – 36
ANS = C

S
Q 23 - x = (“Federal University of Technology, Akure”). What is the output
ES
of x[2:10:2]?
A – drlU
B – ‘drlU’
C – drl U
D – drlUi
CC
ANS = B

Q 24 - matrix = [[45,23,7,-1],[56,22,51,89],[23,56,77,80]]. What is the


output of matrix[1][3]?
A – [[45,23,7,-1],[23,56,77,80]]
SU

B – [[45,23,7,-1],[56,22,51,89],[23,56,77,80]]
C – 89
D – 51
ANS = C

Q 25 - What is the output of the following?


L = [12,10,30]
L.append(13)
print L
A – 12,10,30
B – 12,10,30,13
C – [12,10,30,13]
6
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
D – [13,12,10,30]
ANS = C

Q 26 - What is the output of the following block of code?


D = {}
D[‘Apple’]=4
D[‘Apple’]=8
print D

A – {‘Apple’:4}
B – [‘Apple’:8]
C – {‘Apple’:8}
D – [‘Apple’:8]

S
E – {‘Apple’:4,’Apple’:8}
ANS = C
ES
Q 27 - What is the output of [‘box’]*3?
A – [‘box’][‘box’][‘box’]
B – [boxboxbox]
C – [‘box’,’box’,’box’]
CC
D – [‘boxboxbox’]
ANS = C

Q 28 - What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john',
SU

70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B - list
C – ‘abcd’,786,2.23,’john’,70.2
D - None of the above.
ANS = A

Q 29 - What is the output of print list[0] if list = [ 'abcd', 786 , 2.23, 'john',
70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B - abcd
7
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
C – ‘abcd’
D - None of the above.
ANS = B

Q 30 - What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23,


'john', 70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B – 786,2.23
C - [786, 2.23]
D - None of the above.
ANS = C

S
Q 31 - What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john',
ES
70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B - abcd
C - [786, 2.23]
D - [2.23, 'john', 70.2]
CC
ANS = D

Q 32 - What is the output of print [0:3] if list = [ 'abcd', 786 , 2.23, 'john',
70.2 ]?
A - [ 'abcd', 786 , 2.23, ]
SU

B – ‘abcd’, 786, 2.23


C - Error
D – None of the above
ANS = C

Q 33 - What is the output of print tinylist * 2 if tinylist = [123, 'john']?


A - [123, 'john', 123, 'john']
B - [123, 'john'] * 2
C - tinylisttinylist
D - None of the above.
8
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
ANS = A

Q 34 - What is the output of sample_List[2] = 7 if sample_List =


[2,4,6,8,10]?
A – [7,4,6,8,10]
B – [2,4,6,8,10] = 7
C – [2,4,7,8,10]
D – [7,7,7,7,7]
ANS = C

Q 35 - Which of the following is correct about tuples in python?


A - A tuple is another sequence data type that is similar to the list.

S
B - A tuple consists of a number of values separated by commas.
C - Unlike lists, however, tuples are enclosed within parentheses.
ES
D - All of the above.
ANS = D

Q 36 - What is the output of print list if tuple = ′abcd′, 786, 2.23,′john′,


70.2?
CC
A - ′abcd′, 786, 2.23, ′john′, 70.2
B - tuple
C - Error
D - None of the above.
ANS = A
SU

Q 37 - What is the output of print tuple[0] if tuple = ′abcd′, 786, 2.23,′joh


n′, 70.2?
A - ′abcd′, 786, 2.23, ′john′, 70.2
B - abcd
C – ‘abcd’
D - None of the above.
ANS = B

Q 38 - What is the output of print tuple[1:3] if tuple = ′abcd′, 786, ‘john’,


9
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
2.23, 70.2?
A - 786, 'john'
B - (786, 'john')
C - Error
D - None of the above.
ANS = B

Q 39 - What is the output of print tuple[1:3] if tuple = ′abcd′, 786, 2.23,′


john′, 70.2?
A - Error
B – 786, 2.23

S
C – (786, 2.23)
D - None of the above.
ES
ANS = C

Q 40 - What is the output of print tuple[2:] if tuple = ′abcd′, 786, 2.23,′joh


n′, 70.2?
CC
A - 2.23, ‘john’, 70.2
B - abcd
C - 786, 2.23
D – (2.23, ′john′, 70.2)
ANS = D
SU

Q 41 - What is the output of print tinytuple * 2 if tinytuple = 123,′john′?


A – (123, ′john′, 123, ′john′)
B - 123, ′john′ * 2
C - Error
D - 123, ′john′, 123, ′john′
ANS = A

Q 42- Which of the following is correct about dictionaries in python?


A - Python's dictionaries are kind of hash table type.
10
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
B - They work like associative arrays or hashes found in Perl and consist
of key-value pairs.
C - A dictionary key can be almost any Python type, but are usually
numbers or strings. Values,
on the other hand, can be any arbitrary Python object.
D - All of the above.
ANS = D

Q 43- Which of the following functions of dictionary gets all the keys
from the dictionary?
A - getkeys
B - key

S
C - keys
D - None of the above.
ES
ANS = C

Q 44 - Which of the following function of dictionary gets all the values


from the dictionary?
CC
A - getvalues
B - value
C - values
D - None of the above.
ANS = C
SU

Q 45 - Which of the following function convert a string to an int in


python?
A – int(x[, base])
B – long(x[, base])
C – float(x)
D – str(x)
ANS = A

Q 46 - Which of the following function convert a string to a long in


11
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
python?
A – int(x[, base])
B – long(x[, base)]
C – float(x)
D – str(x)
ANS = B

Q 47 - Which of the following function convert a string to a float in


python?
A – int(x[, base])
B – long(x[, base])
C – float(x)

S
D – str(x)
ANS = C
ES
Q 48 - Which of the following function convert an object to a string in
python?
A – int(x[, base])
CC
B – long(x[, base])
C – float(x)
D – str(x)
ANS = D
SU

Q 49 - Which of the following function convert an object to a regular


expression in python?
A – repr(x)
B – eval(str)
C – tuple(s)
D – list(s)
ANS = A

Q 50 - Which of the following function convert a String to an object in


python?
12
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
A – repr(x)
B – eval(str)
C – tuple(s)
D – list(s)
ANS = B

Q 51 - Which of the following function converts a String to a tuple in


python?
A – repr(x)
B – eval(str)
C – tuple(x)
D – list(x)

S
ANS = C

ES
Q 52 - Which of the following functions convert a String to a list in
python?
A – repr(x)
B – eval(str)
CC
C – tuple(s)
D – list(s)
ANS = D
SU

Q 53 - Which of the following functions convert a String to a set in


python?
A – set(x)
B – dict(d)
C – frozenset(s)
D – chr(x)
ANS = A

Q 54 - Which of the following function convert a sequence of tuples to


dictionary in
python?
13
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
A – set(x)
B – dict(d)
C – frozenset(s)
D – chr(x)
ANS = B

Q 55 - Which of the following function convert a string to a frozen set in


python?
A – set(x)
B – dict(d)
C – frozenset(s)
D – chr(x)

S
ANS = C

ES
Q 56 - Which of the following function convert an integer to a character
in python?
A – set(x)
B – dict(d)
CC
C – frozenset(s)
D – chr(x)
ANS = D
SU

Q 57 - Which of the following function convert an integer to an unicode


character in
python?
A – unichr(x)
B – ord(x)
C – hex(x)
D – oct(x)
ANS = A

Q 58 - Which of the following function convert a single character to its


integer value in
14
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
python?
A – unichr(x)
B – ord(x)
C – hex(x)
D – oct(x)
ANS = B

Q 59 - Which of the following function convert an integer to hexadecimal


string in
python?
A – unichr(x)
B – ord(x)

S
C – hex(x)
D – oct(x)
ES
ANS =C

Q 60 - Which of the following function convert an integer to octal string


in python?
CC
A – unichr(x)
B – ord(x)
C – hex(x)
D – oct(x)
ANS = D
SU

Q 61 - Which of the following operator in python performs exponential


power
calculation on operands?
A - **
B - //
C - is
D - not in
ANS = A

Q 62 - Which of the following operator in python performs the division on


15
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
operands where the result is the quotient in which the digits after the
decimal point are removed?
A - **
B - //
C - is
D - not in
ANS = B

Q 63 - Which of the following operator in python evaluates to true if the


variables on either side of the operator point to the same object and
false otherwise?
A - **

S
B - //
C - is
ES
D - not in
ANS = C

Q 64 - Which of the following operator in python evaluates to true if it


CC
does not finds a variable in the specified sequence and false otherwise?
A - **
B - //
C - is
D - not in
SU

ANS = D

Q 65 - Which of the following statement terminates the loop statement


and transfers execution to the statement immediately following the
loop?
A - break
B - continue
C - pass
D - None of the above.
ANS = A

16
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 66 - Which of the following statement causes the loop to skip the
remainder of its body and immediately retest its condition prior to
reiterating?
A - break
B - continue
C - pass
D - None of the above.
ANS = B

Q 67 - Which of the following statement is used when a statement is


required syntactically but you do not want any command or code to

S
execute?
A - break
ES
B - continue
C - pass
D - None of the above.
ANS = C
CC
Q 68 - Which of the following function returns a random item from a list,
tuple, or string?
A – choice(seq)
B - randrange ([start, ]stop[, step])
SU

C – random()
D – seed([x])
ANS = A

Q 69 - Which of the following function returns a randomly selected


element from range?
A – choice(seq)
B – randrange( [start, ]stop[, step])
C – random()
D – seed([x])
ANS = B
17
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 70 - Which of the following function returns a random float r, such that
0 is less than or equal to r and r is less than 1?
A – choice(seq)
B - randrange ([start, ]stop[, step])
C – random()
D – seed([x])
ANS = C

Q 71 - Which of the following function sets the integer starting value


used in generating random numbers?

S
A – choice(seq)
B – randrange( [start, ]stop[, step])
ES
C – random()
D – seed([x])
ANS = (D
CC
Q 72 - Which of the following function randomizes the items of a list in
place?
A – shuffle(lst)
B – capitalize()
C – isalnum()
SU

D – isdigit()
ANS = A

Q 73 - Which of the following function capitalizes first letter of string?


A – shuffle(lst)
B – capitalize()
C – isalnum()
D – isdigit()
ANS = B

18
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 74 - Which of the following function checks in a string that all
characters are alphanumeric?
A – shuffle(lst)
B – capitalize()
C – isalnum()
D – isdigit()
ANS = C

Q 75 - Which of the following function checks in a string that all


characters are digits?
A – shuffle(lst)
B – capitalize()

S
C – isalnum()
D – isdigit()
ES
ANS = D

Q 76 - Which of the following function checks in a string that all


characters are in lowercase?
CC
A – islower()
B – isnumeric()
C – isspace()
D – istitle()
ANS = A
SU

Q 77 - Which of the following function checks in a string that all


characters are
numeric?
A – islower()
B – isnumeric()
C – isspace()
D – istitle()
ANS = B

19
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 78 - Which of the following function checks in a string that all
characters are
whitespaces?
A – islower()
B – isnumeric()
C – isspace()
D – istitle()
ANS = C

Q 79 - Which of the following function checks in a string that all


characters are
titlecased?

S
A – islower()
B – isnumeric()
ES
C – isspace()
D – istitle()
ANS = D
CC
Q 80 - Which of the following function checks in a string that all
characters are in
uppercase?
A – isupper()
B – join(seq)
SU

C – len(string)
D – ljust(width[, fillchar])
ANS = A

Q 81 - Which of the following function merges elements in a sequence?


A – isupper()
B – join(seq)
C – len(string)
D – ljust(width[, fillchar])
ANS = B

20
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 82 - Which of the following function gets the length of the string?
A – isupper()
B – join(seq)
C – len(string)
D – ljust(width[, fillchar])
ANS = C

Q 83 - Which of the following function gets a space-padded string with


the original
string left-justified to a total of width columns?
A – isupper()

S
B – join(seq)
C – len(string)
ES
D – ljust(width[, fillchar])
ANS = D

Q 84 - Which of the following function converts a string to all lowercase?


CC
A – lower()
B – lstrip()
C – max(str)
D – min(str)
ANS =A
SU

Q 85 - Which of the following function removes all leading whitespace in


string?
A – lower()
B – lstrip()
C – max(str)
D – min(str)
ANS = B

Q 86 - Which of the following function returns the max alphabetical


21
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
character from the string str?
A – cmp()
B – lstrip()
C – max(str)
D – min(str)
ANS = C

Q 87 - Which of the following function returns the min alphabetical


character from the string str?
A – cmp()
B – lstrip()
C – max(str)

S
D – min(str)
ANS = D
ES
Q 88 - Which of the following function replaces all occurrences of old
substring in string with new string?
A – replace(old, new[, max])
CC
B – strip([chars])
C – swapcase()
D – title()
ANS = A
SU

Q 89 - Which of the following function removes all leading and trailing


whitespace in
string?
A – replace(old, new[, max])
B - strip[chars]
C – swapcase()
D – title()
ANS = B

22
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 90 - Which of the following function changes case for all letters in
string?
A – replace(old, new[, max])
B – strip([chars])
C – swapcase()
D – title()
ANS = C

Q 91 - Which of the following function returns title cased version of


string?
A – replace(old, new[, max])
B – strip([chars])

S
C – swapcase()
D – title()
ES
ANS = D

Q 92 - Which of the following function converts a string to all uppercase?


A – upper()
CC
B – isdecimal()
C – swapcase()
D – title()
ANS = A
SU

Q 93 - Which of the following function checks in a string that all


characters are decimal?
A – upper()
B – isdecimal()
C – swapcase()
D – title()
ANS = B

Q 94 - What is the output of len([1, 2, 3])?


A-1
B-2
23
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
C-3
D-4
ANS = C

Q 95 - What is the output of [1, 2, 3] + [4, 5, 6]?


A - [1, 2, 3, 4, 5, 6]
B - [1, 2, 3],[4, 5, 6]
C - [5, 7,9]
D – 21
ANS = A

S
Q 96 - What is the output of ['Hi!'] * 4?
A - ['Hi!', 'Hi!', 'Hi!', 'Hi!']
ES
B - ['Hi!'] * 4
C - Error
D - None of the above.
ANS = A
CC
Q 97 - What is the output of 3 in [1, 2, 3]?
A - true
B - false
C - Error
SU

D - None of the above.


ANS = A

Q 98 - What is the output of L[2] if L = [1,2,3]?


A-1
B-2
C-3
D - None of the above.
ANS = C

24
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
Q 99 - What is the output of L[-2] if L = [1,2,3]?
A-1
B-2
C-3
D - None of the above.
ANS = B

Q 100- What is the output of L[1:] if L = [1,2,3]?


A - 2,3
B-2
C-3

S
D - None of the above.
ANS = A
ES
Q 101 - Which of the following functions compares elements of both
lists?
A – cmp(list1, list2)
CC
B - len(list1, list2)
C - max(list1, list2)
D - min(list1, list2)
ANS = A
SU

Q 102- Which of the following functions gives the total length of the list?
A – cmp(list)
B - len(list)
C - max(list)
D – min(list)
ANS = B

Q 103 – Which of the following functions returns item from the list with
max value?
A - cmp(list)
25
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
B - len(list)
C - max(list)
D – min(list)
ANS = C

Q 104 – Which of the following functions returns item from the list with
min value?
A - cmp(list)
B - len(list)
C - max(list)
D – min(list)
ANS = D

S
Q 105 – Which of the following functions returns the lowest index in list
ES
that obj appears?
A - list.index(obj)
B - list.insert(index, obj)
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
CC
ANS = A

Q 106 – Which of the following functions inserts an object at given index


in a list?
SU

A - list.index(obj)
B - list.insert(index, obj)
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
ANS = B

Q 107 – Whch of the following functions removes last object from a list?
A - list.index(obj)
B - list.insert(index, obj)
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
26
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
ANS = C

Q 108- Which of the following functions removes an object from a list?


A - list.index(obj)
B - list.insert(index, obj)
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
ANS = D

Q 109 – Which of the following functions reverses objects of list in


place?
A - list.reverse
B - list.sort([func])

S
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
ES
ANS =A

Q 110- Which of the following functions sorts a list?


A - list.reverse
B - list.sort([func])
CC
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
ANS = B

Q 111 – Which of the following functions compares elements of both


SU

dictionaries dict1, dict2?


A - dict1.cmp(dict2)
B - dict1.sort(dict2)
C – cmp(dict1, dict2)
D - None of the above.
ANS = C

Q 112 – Which of the following functions compares elements of both


dictionaries dict1, dict2?
A – max(dict)
B – min(dict)
C – len(dict)
27
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS
D - None of the above.
ANS = C

S
ES
CC
SU

28
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS

You might also like