PE2 : Python Essentials 2 – Module 2 Test
-
The following code:
print(ord('c') - ord('a'))
prints:
0
2
3
1
-
The following code:
print (float("1, 3" ))
- prints
1, 3
- raises a
ValueError
exception - prints
1.3
- prints
13
- prints
-
The top-most Python exception is called:
- TopException
- Exception
BaseException
- PythonException
-
The following statement:
assert var == 0
- is erroneous
- will stop the program when
var != 0
- has no effect
- will stop the program when
var == 0
-
UNICODE is a standard:
- used by coders from universities
- honored by the whole universe
- like ASCII, but much more expansive
- for coding floating-point numbers
-
ASCII is:
- a predefined Python variable name
- a standard Python module name
- a character name
- short for American Standard Code for Information Interchange
-
The following code:
print(3 * 'abc' +'xyz')
prints:
xyzxyzxyzxyz
abcabcxyzxyz
abcabcabcxyz
abcxyzxyzxyz
-
UTF-8 is:
- a Python version name
- the 9th version of the UTF standard
- a form of encoding Unicode code points
- a synonym for byte
-
Entering the
try:
block implies that:- all of the instructions from this block will be executed
- some of the instructions from this block may not be executed
- the block will be omitted
- none of the instructions from this block will be executed
-
What is the expected output of the following code?
try print("5"/0) except ArithmeticError: print("arith") except ZeroDivisionError: print("zero") except: print("some")
zero
0
some
arith
-
The unnamed
except:
block:- must be the first one
- can be placed anywhere
- cannot be used if any named block has been used
- must be the last one
-
The following code:
print('Mike' > " Mikey")
prints:
0
1
True
False
-
The following code:
print(chr(ord('z') - 2))
prints:
z
y
a
x
-
The following code:
x = '\' '
print(len(x))
prints:
3
2
20
1
-
Which of the following are examples of Python built-in concrete exceptions?(Select two answers)
ArithemticError
IndexError
BaseException
ImportError
Subscribe
0 Comments
Newest