Python 3 - Mock Test III
Q 1 - Which of the following operator in python evaluates to true if it does not finds a variable in the specified sequence and false otherwise?
A - **
B - //
C - is
D - not in
Q 2 - 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.
Q 3 - 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.
Q 4 - Which of the following statement is used when a statement is required syntactically but you do not want any command or code to execute?
A - break
B - continue
C - pass
D - None of the above.
Q 5 - Which of the following function returns a random item from a list, tuple, or string?
A - choice(seq)
B - randrange ([start,] stop [,step])
C - random()
D - seed([x])
Q 6 - 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])
Q 7 - 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])
Q 8 - Which of the following function sets the integer starting value used in generating random numbers?
A - choice(seq)
B - randrange ([start,] stop [,step])
C - random()
D - seed([x])
Q 9 - Which of the following function randomizes the items of a list in place?
A - shuffle(lst)
B - capitalize()
C - isalnum()
D - isdigit()
Q 10 - Which of the following function capitalizes first letter of string?
A - shuffle(lst)
B - capitalize()
C - isalnum()
D - isdigit()
Q 11 - Which of the following function checks in a string that all characters are alphanumeric?
A - shuffle(lst)
B - capitalize()
C - isalnum()
D - isdigit()
Q 12 - Which of the following function checks in a string that all characters are digits?
A - shuffle(lst)
B - capitalize()
C - isalnum()
D - isdigit()
Q 13 - Which of the following function checks in a string that all characters are in lowercase?
A - islower()
B - isnumeric()
C - isspace()
D - istitle()
Q 14 - Which of the following function checks in a string that all characters are numeric?
A - islower()
B - isnumeric()
C - isspace()
D - istitle()
Q 15 - Which of the following function checks in a string that all characters are whitespaces?
A - islower()
B - isnumeric()
C - isspace()
D - istitle()
Q 16 - Which of the following function checks in a string that all characters are titlecased?
A - islower()
B - isnumeric()
C - isspace()
D - istitle()
Q 17 - Which of the following function checks in a string that all characters are in uppercase?
A - isupper()
B - join(seq)
C - len(string)
D - ljust(width[, fillchar])
Q 18 - Which of the following function merges elements in a sequence?
A - isupper()
B - join(seq)
C - len(string)
D - ljust(width[, fillchar])
Q 19 - Which of the following function gets the length of the string?
A - isupper()
B - join(seq)
C - len(string)
D - ljust(width[, fillchar])
Q 20 - Which of the following function gets a space-padded string with the original string left-justified to a total of width columns?
A - isupper()
B - join(seq)
C - len(string)
D - ljust(width[, fillchar])
Q 21 - Which of the following function converts a string to all lowercase?
A - lower()
B - lstrip()
C - max(str)
D - min(str)
Q 22 - Which of the following function removes all leading whitespace in string?
A - lower()
B - lstrip()
C - max(str)
D - min(str)
Q 23 - Which of the following function returns the max alphabetical character from the string str?
A - lower()
B - lstrip()
C - max(str)
D - min(str)
Q 24 - Which of the following function returns the min alphabetical character from the string str?
A - lower()
B - lstrip()
C - max(str)
D - min(str)
Q 25 - Which of the following function replaces all occurrences of old substring in string with new string?
A - replace(old, new [, max])
B - strip([chars])
C - swapcase()
D - title()
Question NumberAnswer Key
1
D
2
A
3
B
4
C
5
A
6
B
7
C
8
D
9
A
10
B
11
C
12
D
13
A
14
B
15
C
16
D
17
A
18
B
19
C
20
D
21
A
22
B
23
C
24
D
25
A
https://www.tutorialspoint.com/python3/python_mock_test.htm?min=51&max=75
发表评论