CPE Flashcards

1
Q

It is the most important aspect of almost all of the programming language. It also allows us to run a block of code.

A

Decision Making

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

It is a statement used to test a specific condition

A

If-statement

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

It is a statement that is same as the if-statement but this also provides the false case

A

if-else statement

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

It is used to declare a block and also the most used part of python language

A

indentation

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

this statement catches what isn’t caught by the preceding conditions

A

else statement

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

“If the previous conditions were not true, then try this condition” statement

A

elif statement

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

T or F
The flow of the programs written in any programming language is sequential by default

A

True

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

This is also called as pre-tested loop

A

while loop

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

We use this type of loop if we do not know the number of iterations in advance

A

while loop

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

This is also called as per-tested loop

A

for loop

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

We use this type of loop when there’s a need to execute some part until given conditions is satisfied

A

for loop

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

It is best to use it if the number of iterations is known in advance

A

for loop

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

This is also called as post-tested loop

A

do-while loop

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

This type of loop continues until a given condition is satisfied

A

do-while loop

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

This changes the execution from its normal sequence

A

Loop Control Statements

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

With this statement, we can stop the loop even if the while condition is true

A

break

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

With this statement, we can stop the current iteration and proceed with the next one

A

continue

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

This statement runs a block of code once the condition is no longer true

A

Else

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

This generate a sequence of numbers

A

range() function

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

range(x,y,z) - identify the x,y,z’s purpose

A

x - start
y - stop
z - step size

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

A type of collection that is ordered, changeable, and allows duplicate members

A

List

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

A type of collection that is ordered, unchangeable, and allows duplicate members

A

Tuple

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

A type of collection that is Unordered, Unindexed, and no duplicate members

A

Set

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

A type of collection that is Unordered, Changeable, Unindexed, and no duplicate members

A

Dictionary

25
T or F List can store the number of various elements
True
26
T or F List use parenthesis
False, List use square bracket [] Tuple use parenthesis () Sets use curly bracket {}
27
a keyword to determine if the item is present in a list
in-keyword
28
what is the purpose of append() ?
To add item to the end of the list
29
what is the purpose of list() ?
To add an item at the specified index
30
What is the difference between remove() and pop()
remove() - removes the specified item pop() - removes the specified index
31
what is the purpose of clear()
empties the list
32
T or F Tup1 = (50) is how we write a tuple that contains a single value
False, we must still include the coma Tup1=(50,);
33
Enumerate the basic tuple operations
Concatenation(+) Repetition(*) Membership(in)
34
What is the output if Tup1 = (1,2,3,4,5) Tup2 = (6,7,8,9) Tup1*2 = ?
Tup1*2 = (1,2,3,4,5,1,2,3,4,5)
35
This type of tuple operations prints true if a particular item exist, otherwise false
Membership
36
This type of Python collection is used to store multiple items in a single variable
Sets
37
What is the difference between remove() and discard() when an item does not exist
discard() - remains unchanged remove() - ERROR
38
T or F The Union of Two Sets uses a pipe (|) operator
True
39
What operation does the intersection of two sets use?
and &
40
The Difference between Two Sets use ___ operator and the Symmetric Different of Two Sets use ___ operator
Difference between Two Sets - (-) Symmetric Different of Two Sets - (^)
41
This type of Python collection is used to store the data in a key-value pain format
Dictionary
42
T or F Dictionary Key - Multiple Value Value - Can be any type
False, Key - Single Value Value - Can be any type
43
The dictionary uses ___ to separate the key and value
semi-colon (:) Key : Value Employee = {"Name" : "Juanna"}
44
T or F It only takes one line to execute in Java
False
45
T or F Python is a multi-purpose programming language
True
46
T or F Guido Van Rossum chose the name 'Python' for the programming language after being inspired by a popular BBC comedy series
True
47
T or F Python can be used to prototype components into Java implementation
True
48
T or F Python programming language is typically longer in code length compared to Java programs
False
49
T or F You can run Python in a GUI environment
True
50
T or F Python is not suitable for developing applications in various domains of software development
False
51
T or F In Python, can you define a variable without specifying its data type
True
52
T or F Python emphasizes support for common programming methodologies
True
53
T or F The print function can only print literal values
False
54
T or F Variables can change their value over time according to the instruction in a program
True
55
T or F Python does not support Object Oriented Programming Language
False
56
Who named Python?
Guido Van Rossum
57
He named Python after? (This was late on-air 1970's)
Monty Python's Flying Circus
58