Prework - Python Prework Final Exam Flashcards

1
Q

True or False: The following statement creates a dictionary with elements:

d={40:”John”,45:”Peter”}

A

True

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

True or False: The following statement creates a dictionary with elements:

d={}

A

False

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

True or False: The following statement creates a dictionary with elements:

d={“John”:40,”Peter”:45}

A

True

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

True or False: The following statement creates a dictionary with elements:

d={40:”John”,45:”50”}

A

True

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

Suppose that list1 = {2,33,22,14,25}, what would the output for list1[0] be?

A

2

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

True or False: Boolean is a simple data type.

A

True

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

True or False: Floating Point Numbers are a simple data type.

A

True

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

True or False: A string is a simple data type.

A

True

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

True or False: An integer is a simple data type.

A

True

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

True or False: A dictionary is a compound data type.

A

True

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

True or False: An object is a compound data type.

A

False

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

True or False: A list is a compound data type.

A

True

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

True or False: A floating point number is a compound data type.

A

False

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

True or False: “While” is a keyword in Python?

A

True

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

True or False: “For” is a keyword in Python?

A

True

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

How many unique comparators are found in Python?

A
6 {==
!=
>=
<=
>< }
17
Q

What is a statement that control the flow of execution depending on some condition.

A

A conditional statement

18
Q

What is a statement that iterates over the elements or members of a sequence in order?

A

A for loop

19
Q

Whch 3 Python keywords comprise a conditional statement?

A
  • If
  • Elif
  • Else
20
Q

What will the output of this python code snippet be?

list = {“Hello” , “This” , “is” , “a” , “list”}
print(list{4})

A

list