Programming fundamentals Flashcards

1
Q
A variable is a name that represents values stored in the computer's \_\_\_\_\_\_.
•	Memory
•	CPU
•	Screen
•	Hard drive
A

Memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
The output of the following statement is \_\_\_\_.
print(-5//2)
•	-3
•	-2.5
•	3
•	2.5
A

-3

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

Python allows programmers to break a statement into multiple lines.
TRUE
FALSE

A

TRUE

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

A computers CUP can only understand instructions that are written as a sequence of bits.
TRUE
FALSE

A

TRUE

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

The format specifier is a string that contains special characters specifying how the numeric value should be formatted.
TRUE
FALSE

A

TRUE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
The argument \_\_\_\_ is passed to the print function. This specifies that the print function should print a space instead of a newline character at the end of its output.
•	End=’ ‘
•	\,
•	Backslash
•	comma
A

end=’ ‘

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

The python language uses a compiler, which translates a high-level language program into a complete machine language program.
TRUE
FALSE

A

FALSE

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

According to the behaviour of integer division, when an integer is divided by an integer, the result will be a float.
TRUE
FALSE

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
A \_\_\_\_\_\_ is a diagram that graphically depicts the steps that take place in a program.
•	Flowchart
•	Pseudocode
•	Algorithm
•	Program
A

Flowchart

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

Comments in Python begin with # character.
TRUE
FALSE

A

TRUE

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

The instruction set for a microprocessor is unique and is typically understood only by the microprocessors of the same brand.
TRUE
FALSE

A

TRUE

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

Python formats all floating-point numbers to two decimal places when outputting with the print statement.
TRUE
FALSE

A

FALSE

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

In Python, print statements written on separate lines do not necessarily output on seperate lines.
TRUE
FALSE

A

TRUE

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

Choose all that apply. To create a Python program you can use:
Excel
IDLE
A text editor
A word processor if you save your file as a .docx

A

IDLE

A text editor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q
What is the informal language, used by programmers to create models of programs, that has no syntax rules and is not meant to be compiled or executed?
•	Flowchart
•	Pseudocode
•	Algorithm
•	Source code
A

Pseudocode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
The \_\_\_\_ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.
•	input()
•	output()
•	eval_input()
•	str_input()
A

input()

17
Q
Which mathematical operator is used to raise 5 to the second power in Python?
•	/
•	~
•	^
•	**
A

**

18
Q
In a print statement, you can set the \_\_\_\_\_ argument to a space or empty string to stop the output from advancing to a new line.
•	end
•	separator
•	newLine
•	stop
A

end

19
Q
After the execution of the following statement, the variable price will reference the value \_\_\_\_\_.
price = int(68.549)
•	68
•	68.6
•	69
•	68.55
A

68

20
Q
Which of the following will display 20%
•	print(format(0.2, ‘.0%’)) 
•	print(format(0.2 * 100, '.0%')) 
•	print(format(20, '.0%')) 
•	print(format(0.2, '%'))
A

print(format(0.2, ‘.0%’))

21
Q
The output of the following print statement is \_\_\_\_
print('I\'m ready to begin')
•	I’m ready to begin
•	Im ready to begin
•	I\’m ready to begin
•	‘\’m ready to begin.
A

I’m ready to begin

22
Q

As per Python variable naming rules, the uppercase and lowercase characters are not distinct.
TRUE
FALSE

A

FALSE