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
Q

T or F
List can store the number of various elements

A

True

26
Q

T or F
List use parenthesis

A

False, List use square bracket []
Tuple use parenthesis ()
Sets use curly bracket {}

27
Q

a keyword to determine if the item is present in a list

A

in-keyword

28
Q

what is the purpose of append() ?

A

To add item to the end of the list

29
Q

what is the purpose of list() ?

A

To add an item at the specified index

30
Q

What is the difference between remove() and pop()

A

remove() - removes the specified item
pop() - removes the specified index

31
Q

what is the purpose of clear()

A

empties the list

32
Q

T or F
Tup1 = (50) is how we write a tuple that contains a single value

A

False, we must still include the coma
Tup1=(50,);

33
Q

Enumerate the basic tuple operations

A

Concatenation(+)
Repetition(*)
Membership(in)

34
Q

What is the output if
Tup1 = (1,2,3,4,5)
Tup2 = (6,7,8,9)

Tup1*2 = ?

A

Tup1*2 = (1,2,3,4,5,1,2,3,4,5)

35
Q

This type of tuple operations prints true if a particular item exist, otherwise false

A

Membership

36
Q

This type of Python collection is used to store multiple items in a single variable

A

Sets

37
Q

What is the difference between remove() and discard() when an item does not exist

A

discard() - remains unchanged
remove() - ERROR

38
Q

T or F
The Union of Two Sets uses a pipe (|) operator

A

True

39
Q

What operation does the intersection of two sets use?

A

and &

40
Q

The Difference between Two Sets use ___ operator and the Symmetric Different of Two Sets use ___ operator

A

Difference between Two Sets - (-)
Symmetric Different of Two Sets - (^)

41
Q

This type of Python collection is used to store the data in a key-value pain format

A

Dictionary

42
Q

T or F
Dictionary

Key - Multiple Value
Value - Can be any type

A

False,

Key - Single Value
Value - Can be any type

43
Q

The dictionary uses ___ to separate the key and value

A

semi-colon (:)

Key : Value
Employee = {“Name” : “Juanna”}

44
Q

T or F
It only takes one line to execute in Java

A

False

45
Q

T or F
Python is a multi-purpose programming language

A

True

46
Q

T or F
Guido Van Rossum chose the name ‘Python’ for the programming language after being inspired by a popular BBC comedy series

A

True

47
Q

T or F
Python can be used to prototype components into Java implementation

A

True

48
Q

T or F
Python programming language is typically longer in code length compared to Java programs

A

False

49
Q

T or F
You can run Python in a GUI environment

A

True

50
Q

T or F
Python is not suitable for developing applications in various domains of software development

A

False

51
Q

T or F
In Python, can you define a variable without specifying its data type

A

True

52
Q

T or F
Python emphasizes support for common programming methodologies

A

True

53
Q

T or F
The print function can only print literal values

A

False

54
Q

T or F
Variables can change their value over time according to the instruction in a program

A

True

55
Q

T or F
Python does not support Object Oriented Programming Language

A

False

56
Q

Who named Python?

A

Guido Van Rossum

57
Q

He named Python after? (This was late on-air 1970’s)

A

Monty Python’s Flying Circus

58
Q
A