Programing quiz #2

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/15

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

16 Terms

1
New cards

How can you determine the type of a variable?

Use the type function.

2
New cards

What is the data type of ‘this is what kind of data’?

string

3
New cards

What value is printed when the following statement executes?

print( int(53.785) )

53

4
New cards

What is printed when the following statements execute?

day = "Thursday"
day = 32.5
day = 19
print(day)

19

5
New cards

True or False: the following is a legal variable name in Python: A_good_grade_is_A+

false

6
New cards

What value is printed when the following statement executes?

print(18 / 4)

4.5

7
New cards

What value is printed when the following statement executes?

print(18 // 4)

4

8
New cards

What value is printed when the following statement executes?

print(18 % 4)

2

9
New cards

What is printed when the following statements execute?

n = input("Please enter your age: ")
# user types in 18
print ( type(n) )A. <class 'str'>

<class 'str'>

10
New cards

: Click on all of the variables of type int in the code below

seconds = input("Please enter the number of seconds you wish to convert")

hours = int(seconds) // 3600
total_secs = int(seconds)
secs_still_remaining = total_secs % 3600
print(secs_still_remaining)

hours, total_seconds, secs_still_remaining, total_secs, and secs_still_remaining

11
New cards

: Click on all of the variables of type str in the code below


hours = int(seconds) // 3600
total_secs = int(seconds)
secs_still_remaining = total_secs % 3600
print(secs_still_remaining)

seconds, seconds, seconds

12
New cards

What is the value of the following expression:

16 - 2 * 5 // 3 + 1

14

13
New cards

What is the value of the following expression:

2 ** 2 ** 3 * 3

768

14
New cards

After the following statements, what are the values of x and y?

x = 15
y = x
x = 22

x is 22 and y is 15

15
New cards

What is printed when the following statements execute?

x = 12
x = x - 1
print(x)

11

16
New cards

What is printed when the following statements execute?

x = 12
x = x - 3
x = x + 5
x = x + 1
print(x)

15