Python 3 - Mock Test I
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.
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.
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.
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.
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
C - PYTHONCASEOK
D - PYTHONHOME
Q 5 - Which of the following environment variable for Python contains the path of an initialization file containing Python source code?
A - PYTHONPATH
B - PYTHONSTARTUP
C - PYTHONCASEOK
D - PYTHONHOME
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
Q 7 - Which of the following environment variable for Python is an alternative module search path?
A - PYTHONPATH
B - PYTHONSTARTUP
C - PYTHONCASEOK
D - PYTHONHOME
Q 8 - Is python a case sensitive language?
A - true
B - false
Q 9 - Which of the following data types is not supported in python?
A - Numbers
B - String
C - List
D - Slice
Q 10 - Which of the following data types is not supported in python?
A - Tuple
B - Dictionary
C - Generics
D - List
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.
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.
Q 13 - What is the output of print str[2:5] if str = 'Hello World!'?
A - llo World!
B - H
C - llo
D - None of the above.
Q 14 - What is the output of print str[2:] if str = 'Hello World!'?
A - llo World!
B - H
C - llo
D - None of the above.
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.
Q 16 - What is the output of print list if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B - list
C - Error
D - None of the above.
Q 17 - 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
C - Error
D - None of the above.
Q 18 - 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 - abcd
C - [786, 2.23]
D - None of the above.
Q 19 - What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
A - [ 'abcd', 786 , 2.23, 'john', 70.2 ]
B - abcd
C - [786, 2.23]
D - [2.23, 'john', 70.2]
Q 20 - What is the output of print tinylist * 2 if tinylist = [123, 'john']?
A - [123, 'john', 123, 'john']
B - [123, 'john'] * 2
C - Error
D - None of the above.
Q 21 - What is the output of print tinylist * 2 if tinylist = [123, 'john']?
A - [123, 'john', 123, 'john']
B - [123, 'john'] * 2
C - Error
D - None of the above.
Q 22 - Which of the following is correct about tuples in python?
A - A tuple is another sequence data type that is similar to the list.
B - A tuple consists of a number of values separated by commas.
C - Unlike lists, however, tuples are enclosed within parentheses.
D - All of the above.
Q 23 - What is the output of print list if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
A - ( 'abcd', 786 , 2.23, 'john', 70.2 )
B - tuple
C - Error
D - None of the above.
Q 24 - What is the output of print tuple[0] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
A - ( 'abcd', 786 , 2.23, 'john', 70.2 )
B - abcd
C - Error
D - None of the above.
Q 25 - What is the output of print tuple[1:3] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?
A - ( 'abcd', 786 , 2.23, 'john', 70.2 )
B - abcd
C - (786, 2.23)
D - None of the above.
Question NumberAnswer Key
1
D
2
D
3
C
4
A
5
B
6
C
7
D
8
A
9
D
10
C
11
A
12
B
13
C
14
A
15
A
16
A
17
B
18
C
19
D
20
A
21
A
22
D
23
A
24
B
25
C
REF
https://www.tutorialspoint.com/python3/python_mock_test.htm?min=1&max=25
发表评论