CSC 201 obj test-1
CSC 201 obj test-1
S
ES
Q 1 - Which of the following is correct about Python?
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
S
C - PYTHONCASEOK
D – PYTHONHOME
ES
ANS = A
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
A - Tuple
B - Dictionary
C - Generics
D – List
ANS = C
S
B-H
C - llo
ES
D - None of the above.
ANS = C
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
S
A – ecneics retu
B – p cpe see
ES
C – syntax error
D - mpu
ANS = A
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
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
B – [[45,23,7,-1],[56,22,51,89],[23,56,77,80]]
C – 89
D – 51
ANS = C
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
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
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
S
C – (786, 2.23)
D - None of the above.
ES
ANS = C
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
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
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
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
S
C – hex(x)
D – oct(x)
ES
ANS =C
S
B - //
C - is
ES
D - not in
ANS = C
ANS = D
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
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
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
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
S
C – isalnum()
D – isdigit()
ES
ANS = D
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
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
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
S
B – join(seq)
C – len(string)
ES
D – ljust(width[, fillchar])
ANS = D
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
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
S
C – swapcase()
D – title()
ES
ANS = D
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
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
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
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
S
C - list.pop(obj = list[ − 1])
D - list.remove(obj)
ES
ANS =A
S
ES
CC
SU
28
COMPILIED BY “OLUGBENGA” CONTACT 07035617005 FOR COMMENTS