quiz 1 Flashcards

1
Q

Which of the following are true about Python:
(1) Python is interpreted
(2) Python is Object Oriented
(3) Python is interactive

A

All are correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which of the following statements is true?:

a. Python 3 is a newer version, but it is backward compatible with Python 2.

b. Python 3 is a newer version, but it is not backward compatible with Python 2.

c. A Python 2 program can always run on a Python 3 interpreter.

d. A Python 3 program can always run on a Python 2 interpreter.

A

b. Python 3 is a newer version, but it is not backward compatible with Python 2.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Converting a variable’s value from one data type to another is most often called _________

A

casting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Python syntax is case-sensitive.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In Python, a syntax error is detected by the ________ at _________.

A

interpreter/at runtime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Consider this Python code:

value = input(“Please enter a number:”)
value = int(value)
print(“You entered”, value)

If we ran this code and a user entered spam as the input to the prompt, what would be the output?

A

Error (“spam” is not an integer)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A Python line comment begins with ________.

A

#

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Select ALL of the correct statement(s):

a. print(‘Hello world’) # This is a statement.

b. An expression performs some task but does not return a value.

c. A statement is a combination of values and operations that creates a new value.

d. A statement may have a side effect.

A

A and D

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Python features include:
(1) interactive mode
(2) portable
(3) easy to add modules

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly