dcit22a Flashcards

1
Q

These are the programming errors

A

Bug

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

First Bug

A

Harvard University, 1947

Mark II was having consistent errors

A literal bug – a moth

Disrupted the electronics of the computer

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

Types of Errors

A

Syntax Error
Semantic Error

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

Syntax Error is also called as?

A

Parsing Error

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

Caused by improper format or syntax in Python

A

Syntax Error

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

Usually pointed out by the interpreter during translation

A

Syntax Error

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

Samples of Syntax Error (4)

A

Typographical errors
Improper case
Incorrect indentation
Missing or incorrect arguments or symbols

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

Interpretation Time (Syntax Error)

A

Happens when you ask Python to run your program

The interpreter does not understand a line of code
(It does not understand what you want it to do)

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

Happens when the syntax is correct – no error messages produced – but the program logic is not, thus resulting to incorrect output or result

A

Semantic Error

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

May cause the program to crash

A

Semantic Error

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

Usually more difficult to find and may sometimes need a debugger to find it

A

Semantic Error

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

Runtime (Semantic Error)

A

Happens after the code has been interpreted and the computer executes it

Execution may stop and display an error or exception message

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

Possible Reasons for Runtime Errors (5)

A

Incorrect program logic
Incorrect user input
Lack of error handling code
Network error (necessary resources might be unavailable)
Hardware error

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

The process of finding and correcting errors or bugs in the program code

A

Debugging

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

How to avoid debugging? (3)

A

Understand the problem
Start Small
Keep improving your code

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

Helpful for finding and correcting bugs that are difficult to find

A

Debugger

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

In the IDLE, ___ is the Python Debugger and is part of the standard library

A

pdb

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

Other python IDEs also has _____ debuggers

A

built-in

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

The order of execution of statements is _____, by default – from top to bottom

A

linear

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

The order of executing statements in a program

A

Flow of Control

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

The _____ data type is fundamental to the flow of control

A

Boolean

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

Remember that it has two (2) possible values:

A

True or False

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

Set by relational operators (6):

A

==, ! =, >, <, >=, <=

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

Part of every programming language are statements that can tweak or modify the said order, which allows programmers to (2):

A

Decide whether or not to execute a particular statement (or code block)

Repeatedly perform a particular statement (or code block)

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

How do humans make decisions? (4)

A

Based on experience

Based on calculations or predictions

Based on other’s suggestions/recommendations

Based on gut or feelings

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

Decision-making by computers (3)

A

Get the current or actual value of something

Compare this to a desired value

Act accordingly (based on the comparison)

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

Decision Control Structures (5)

A

Conditional Statement
If Statement
If… Else Statement
Making Multiple Comparisonsa
Elif Structure

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

Conditional Statement is also called a?

A

branch

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

Piece of code that is executed under certain conditions (If the condition is not met, this will not be executed)

A

Conditional Statement

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

Helps a program to have the ability to react on different states that resulted from computations and/or inputs

A

Conditional Statement

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

The most basic decision control structure

A

If Statement

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

Executes a line or block of code if the condition is met – if the Boolean expression returns True

A

If Statement

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

The general format of an if statement is:

A

if condition:

statement/s

34
Q

the __ indicates the end of the condition

A

: or colon

35
Q

the code block is _____ with respect to the rest of the code: to clearly identify which part of the code depends on the current condition

A

indented

36
Q

Used when you want an alternative course of action(s) if the condition in the if statement was not met

(The else clause is executed in this case)

A

If… Else Statement

37
Q

The general format of an if…else statement is:

A

if condition:

statement/s 1

else:

statement/s 2

38
Q

Series of statements is also called as?

A

code block

39
Q

It is necessary when dealing with multiple requirements

A

Making Multiple Comparisons

40
Q

In programming, logical operators – ___, __, ___ – are combined with relational operators to do multiple comparisons

A

and, or, not

41
Q

Made up from the combination of else and if

A

Elif Structure

42
Q

Used when if…else is not enough to handle all possible conditions or courses of actions

A

Elif Structure

43
Q

The general format of elif structure is:

A

if condition:

statement/s 1

elif condition:

statement/s 2

else:

statement/s 3

44
Q

You may have more than one elif statement.

True or False

A

True

45
Q

You may or may not have else when you use elif.

True or False

A

True

46
Q

If there are ___________, the interpreter would check all the conditions within those statements – they are treated as individual, unrelated conditions

A

multiple if statements

47
Q

Using ____ “tells” the interpreter that the conditions from if, the following elif statements, and else are connected and related to each other

A

elif

48
Q

Handles multi-level decision-making

A

Nested decision statements

49
Q

Process of making decisions in different levels

A

Nesting

50
Q

Repetitive statements = ____ statements

A

loop statements

51
Q

repetition is viewed as a _____

A

circle

52
Q

Iterative Statements rely on __________ ____________ when to stop looping

A

relational statements

53
Q

Without them (relational statements), loops would go on forever – ______ _____

A

infinite loop

54
Q

Python has two primitive kinds of iterative statements:

A

for loop
while loop

55
Q

Each loop has the following (sometimes, only implicitly): (4)

A

A control variable or loop counter

The initial value

The loop continuation condition

The increment or decrement

56
Q

Statements under this will be executed repeatedly while the condition returns True

(Once the condition returns False, the line after the loop will be executed)

A

While Loop

57
Q

While Loop format:

A

while condition:

statement/s

58
Q

Used for looping sequences – list, string, number range

A

For Loop

59
Q

For Loop format:

A

for iterating_var in sequence:

statement/s

60
Q

This returns a sequence of numbers

A

Range Function

61
Q

By default, range function starts at _, and increments by _

A

starts at 0
increments by 1

62
Q

Range Function does not work on _____ _____ numbers

A

floating point numbers

63
Q

May be a number or variable with numerical value (3)

A

range (value)

range (start, stop)

range (start, stop, step)

64
Q

A loop in which the number of times it is going to execute is known in advance before entering the loop

A

Definite Loop

65
Q

The number of loops or iterations depend on the user input

A

Indefinite Loop

66
Q

In python, the _______ function ends with a new line

A

print ( )

67
Q

Stops the loop even when the looping continuation condition still returns True and executes the statement/s after the loop

However, it must be under an ___ statement (which is also within the loop)

A

Break Statement

an If statement

68
Q

Similar to break, it is part of an if statement within a loop

A

Continue Statement

69
Q

Processing proceeds to the next element in the sequence instead of ending the loop completely

A

Continue Statement

70
Q

Technically, the element(s) that will meet the condition in the if statement will be skipped in the processing in the loop

A

Continue Statement

71
Q

Used when a statement is required syntactically but you do not want any code to execute – a null statement

A

Pass Statement

72
Q

Similar to the continue clause, but executes the code below it (which is also inside the if code block where the pass statement is included)

A

Pass Statement

73
Q

Useful to place for parts of code that you will put some code, but haven’t written yet – to avoid error

(This is because the interpreter ignores the pass statement and continues with the rest of the code)

A

Pass Statement

74
Q

Executes a code when all the iterations have been completed, and NOT indefinitely terminated by a break statement

A

Else Statement

75
Q

The program exits the loop only after the else block is executed

A

Else Statement

76
Q

Seems unnecessary, but may serve as a flag that the loop was finished

A

Else Statement

77
Q

Allow us to execute a statement or block of code multiple times

A

Control Structure

78
Q

Meaning the start value is greater than the stop value
It is required to have a negative step value

A

Reverse Range

79
Q

It brings control out of the loop

A

Break

80
Q

It returns control back to the beginning of the loop

A

Continue