Intro to Python: Ch 1

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

What is the difference between an editor and an interpreter? An editor allows program files to be entered and modified; an interpreter reads and executes program files An editor allows program files to be entered and modified; an interpreter produces an indexed database of terms and keywords An editor allows program files to be entered and modified; an interpreter produces an organized list of files An editor converts program files into an executable program; an interpreter allows program files to be entered and modified

An editor allows program files to be entered and modified; an interpreter reads and executes program files

Which of the following is considered a string in Python? Today is Wednesday "Today is Wednesday" # Today is Wednesday # Today_is_Wednesday

"Today is Wednesday"

What is printed by the following code snippet? print(25 + 84) 2584 109 25 + 84 Nothing, this code snipped causes a compile time error

109

What is printed by the following code snippet? print("25 + 84") 2584 109 25 + 84 Nothing, this code snipped causes a compile time error

25 + 84

What is printed by the following code snippet? print("Good", "Morning", "Class", "!") GoodMorningClass! Good Morning Class! Good Morning Class ! nothing, this code produces a syntax error

Good Morning Class !

Which line in the following program is a comment line?\ 1: print("Your lucky number is...") 2: lucky = 7 3: # Display the lucky number 4: print(lucky)

Line number 3

Which type of error is usually the most difficult to locate in your program? Indentation Error Logic Error Syntax Error Zero Division Error

Logic Error

What is printed by the following code snippet? print(Hello) Nothing, an error is produced indicating that Hello is not defined Hello 'Hello' "Hello"

Nothing, an error is produced indicating that Hello is not defined

What is wrong with the following code snippet: num1 = 10 num2 = 20 num3 = 30 total = Num1 + Num2 + Num3

Python is case sensitive so Num1, Num2, and Num3 are undefined

Which parts of the computer store program code? CPU Secondary storage Monitor Keyboard

Secondary storage

What is another name for a compile-time error? Logic error Semantic error Syntax error Lexicographic error

Syntax error

What is printed by the following code snippet? print("The answer is", 25 + 84) The answer is 2584 The answer is 109 The answer is 25 + 84 Nothing, this code snipped causes a compile time error

The answer is 109

What is printed by the following code snippet? print("The answers are:", 4 + 3 * 2, 7 * 5 - 24) The answers are: 10 11 The answers are: 14 11 The answers are: 24 10 Nothing, this code snipped causes a compile time error

The answers are: 10 11

Although the following code statement is valid, print(10/0), what will happen when this code is executed? The program prints 0 The error message ZeroDivisionError: int division or modulo by zero is displayed The program runs, but nothing is printed The error message SyntaxError: EOL while scanning string literal

The error message ZeroDivisionError: int division or modulo by zero is displayed

print("Hello") print("World!") The print function cannot be called twice The print function is missing an argument Nothing, the program prints Hello World on the same line The second line should not be indented

The second line should not be indented

Which of the following code segments will display Hello World! when it is run? print(Hello "," World"!") print("Hello", "World!") print("Hello", "World", "!") print("Hello", ",", "World", "!")

print("Hello", "World!")

What extension is used for Python files? .Python .py .dat .txt

py

What is the correct sequence of steps invoked by the Python Interpreter: source code -> virtual machine -> byte code -> compiler source code -> compiler -> byte code -> virtual machine compiler -> source code -> virtual machine -> byte code byte code -> virtual machine -> source code -> compiler

source code -> compiler -> byte code -> virtual machine

When the computer begins to run a program, the program is moved from secondary storage to memory. the program is moved from secondary storage to the network controller. the program is moved from the CPU to memory. the program is moved from the CPU to secondary storage.

the program is moved from secondary storage to memory.


Kaugnay na mga set ng pag-aaral

minimizing human impact on environment biology terms

View Set

Unit 4: Plant Growth and Development (Lesson 14)

View Set

Economics Chapters (10, 11, 12, 13, 14, 15)

View Set

RT exam- C7- ensure infection control

View Set