WorksheetsProgramming Boot Camp-Quiz I
Total questions: 30
Worksheet time: 16mins
What is machine code?
A low-level programming language consisting of binary digits/bits that the computer reads and understands
A high-level programming language consisting of instruction lists that humans can read and understand
A low-level programming language consisting of hexadecimal digits that make up high-level language instructions
A medium-level programming language consisting of the assembly code designed for the computer processor
What are the four fundamental elements that make a language?
An alphabet, a lexis, phonetics, and semantics
An alphabet, phonetics, phonology, and semantics
An alphabet, a lexis, a syntax, and semantics
An alphabet, morphology, phonetics, and semantics
What do you call a file containing a program written in a high-level programming language?
A code file
A machine file
A source file
A target file
What is true about compilation? (Select two answers)
Both you and the end user must have the compiler to run your code
It tends to be slower than interpretation
The code is converted directly into machine code executable by the processor
It tends to be faster than interpretation
What is the best definition of a script?
It's an error message generated by the interpreter
It's an error message generated by the compiler
It's a text file that contains sequences of zeroes and ones
It's a text file that contains instructions which make up a Python program
Select the true statements. (Select two answers)
Python is a good choice for creating and executing tests for applications
Python is free, open-source, and multiplatform
Python is a good choice for low-level programming, e.g., when you want to implement an effective driver
Python 3 is backwards compatible with Python 2
What is CPython?
It's the default, reference implementation of the C language, written in Python
It's the default, reference implementation of Python, written in the C language
It's a programming language that is a superset of the C language, designed to produce Python-like performance with code written in C
It's a programming language that is a superset of Python, designed to produce C-like performance with code written in Python
What do you call a command-line interpreter which lets you interact with your OS and execute Python commands and scripts?
A console
Jython
A compiler
An editor
What is the expected behavior of the following program?
print("Hello!")
The program will output Hello! to the screen
The program will output "Hello!" to the screen
The program will generate an error message on the screen
The program will output ("Hello!") to the screen
What is the expected behavior of the following program?
prin("Goodbye!")
The program will generate an error message on the screen
The program will output "Goodbye!" to the screen
The program will output Goodbye! to the screen
The program will output ("Goodbye!") to the screen
The \n digraph forces the print() function to:
break the output line
output exactly two characters: \ and n
duplicate the character next to the digraph
stop its execution
The meaning of the keyword parameter is determined by:
the argument's name specified along with its value
its value
its position within the argument list
its connection with existing variables
The value twenty point twelve times ten raised to the power of eight should be written as:
20.12E8
20E12.8
20.12*10^8
20.12E8.0
The 0o prefix means that the number after it is denoted as:
octal
hexadecimal
binary
decimal
The ** operator:
performs exponentiation
performs duplicated multiplication
performs floating-point multiplication
does not exist
The result of the following division:
1 / 1
cannot be evaluated
is equal to 1.0
is equal to 1
cannot be predicted
Which of the following statements are true? (Select two answers)
The ** operator uses right-sided binding.
The right argument of the % operator cannot be zero.
The result of the / operator is always an integer value.
Addition precedes multiplication.
Left-sided binding determines that the result of the following expression:
1 // 2 * 3 is equal to:
0
0.0
0.16666666666666666
4.5
Which of the following variable names are illegal? (Select two answers)
and
TRUE
True
true
The print() function can output values of:
any number of arguments (excluding zero)
not more than five arguments
just one argument
any number of arguments (including zero)
What is the output of the following snippet?
x = 1
y = 2
z = x
x = y
y = z
print(x, y)
2 1
2 2
1 2
1 1
What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively?
x = int(input())
y = int(input())
x = x // y
y = y // x
print(y)
the code will cause a runtime error
8.0
4.0
2.0
What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively?
x = int(input())
y = int(input())
x = x / y
y = y / x
print(y)
the code will cause a runtime error
8.0
2.0
4.0
What is the output of the following snippet if the user enters two lines containing 11 and 4 respectively?
x = int(input())
y = int(input())
x = x % y
x = x % y
y = y % x
print(y)
1
2
3
4
What is the output of the following snippet if the user enters two lines containing 2 and 4 respectively?
x = int(input())
y = int(input())
print(x + y)
24
6
4
2
What is the output of the following snippet?
x = 1 / 2 + 3 // 3 + 4 ** 2
print(x)
8
17
8.5
17.5
What is the output of the following snippet?
y = 2 + 3 * 5.
print(Y)
17.0
25.
17
the snippet will cause an execution error
What is the output of the following snippet?
z = y = x = 1
print(x, y, z, sep='*')
1 1 1
x y z
x*y*z
1*1*1
What is the output of the following snippet if the user enters two lines containing 3 and 6 respectively?
x = input()
y = int(input())
print(x * y)
333333
36
18
666
What is the output of the following snippet if the user enters two lines containing 11 and 4 respectively?
x = int(input())
y = int(input())
x = x % y
x = x % y
y = y % x
print(y)
1
2
3
4
