MCQGeeks
0 : 0 : 1
CBSE
JEE
NTSE
NEET
English
UK Quiz
Quiz
Driving Test
Practice
Games
Quiz
Python
Tricky Python
Quiz 1
1
2
3
4
5
6
7
8
9
10
Q.1
What will be the output of the following Python code? def foo(k): k = [q = [foo(q) print(q)
a) [0]
b) [1]
c) [1, 0]
d) [0, 1]
Q.2
How are variable length arguments specified in the function heading?
a) one star followed by a valid identifier
b) one underscore followed by a valid identifier
c) two stars followed by a valid identifier
d) two underscores followed by a valid identifier
Q.3
Which module in the python standard library parses options received from the command line?
a) getopt
b) os
c) getarg
d) main
Q.4
What is the type of sys.argv?
a) set
b) list
c) tuple
d) string
Q.5
What is the value stored in sys.argv[0]?
a) null
b) you cannot access it
c) the program’s name
d) the first argument
Q.6
How are default arguments specified in the function heading?
a) identifier followed by an equal to sign and the default value
b) identifier followed by the default value within backticks (“)
c) identifier followed by the default value within square brackets ([])
d) identifier
Q.7
How are required arguments specified in the function heading?
a) identifier followed by an equal to sign and the default value
b) identifier followed by the default value within backticks (“)
c) identifier followed by the default value within square brackets ([])
d) identifier
Q.8
What will be the output of the following Python code? def foo(x): x[= ['def'] x[= ['abc'] return id(x) q = ['abc', 'def'] print(id(q) == foo(q))
a) True
b) False
c) None
d) Error
Q.9
Where are the arguments received from the command line stored?
a) sys.argv
b) os.argv
c) argv
d) none of the mentioned
Q.10
What will be the output of the following Python code? def foo(i, x=[]): x.append(x.append(i)) return x for i in range(3): y = foo(i) print(y)
a) [[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]
b) [[0], [[0], 1], [[0], [[0], 1], 2]]
c) [0, None, 1, None, 2, None]
d) [[[0]], [[[0]], [1]], [[[0]], [[[0]], [1]], [2]]]
0 h : 0 m : 1 s
1
2
3
4
5
6
7
8
9
10
Report Question
×
What's an issue?
Question is wrong
Answer is wrong
Other Reason
Want to elaborate a bit more? (optional)
Support mcqgeeks.com by disabling your adblocker.
×
Please disable the adBlock and continue.
Thank you.
Reload page