PE2 Module 2

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The following code: x = '\' ' print(len(x)) prints: 3 2 20 1

1

The following code: print(ord('c') - ord('a')) prints: 0 2 3 1

2

The top-most Python exception is called: TopException Exception BaseException PythonException

BaseException

The following code: print('Mike' > " Mikey") prints: 0 1 True False

False

Which of the following are examples of Python built-in concrete exceptions?(Select two answers) ArithemticError IndexError BaseException ImportError

IndexError ImportError

The following code: print (float("1, 3" )) prints 1, 3 raises a ValueError exception prints 1.3 prints 13

Raises a ValueError exception

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

a form of encoding Unicode code points

The following code: print(3 * 'abc' +'xyz') prints: xyzxyzxyzxyz abcabcxyzxyz abcabcabcxyz abcxyzxyzxyz

abcabcabcxyz

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

like ASCII, but much more expansive

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

must be the last one

ASCII is: a predefined Python variable name a standard Python module name a character name short for American Standard Code for Information Interchange

short for American Standard Code for Information Interchange

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

some

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

some of the instructions from this block may not be executed

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

will stop the program when var != 0

The following code: print(chr(ord('z') - 2)) prints: z y a x

x


Kaugnay na mga set ng pag-aaral

Government and Economics Final review

View Set

Chapter 6 ■ Identity and Access Control ExamQ

View Set

Induction and Augmentation of Labor

View Set

U2 What is the relationship between education and values?

View Set

Sadlier-Oxford Vocabulary Workshop Level G Units 9-10

View Set