Iteration — Unit test Answers

0 verified answers
1
Free Preview

A Python programmer is writing a function definition. What syntax should be used?

A
def( statement ): functionName argument1 argument2 argument3
B
def functionName( arguments ): statement1 statement2 statement3
C
def functionName( statement ): argument1 argument2 argument3
D
def( arguments ): functionName statement1 statement2 statement3
2
Free Preview

Why is it important to use correct syntax?

A
to demonstrate a sophisticated programming style
B
to demonstrate a flexible programming style
C
to ensure that programs will work on any computer platform
D
to ensure that programs run properly and return expected results
3

Which data representation system utilizes both letters and numbers?

A
binary
B
decimal
C
hexadecimal
D
octal
4

Mikhail is working in an IDE and needs to test a program one step at a time to find and fix errors. What tool should he use?

A
a compiler
B
a source code editor
C
a debugger
D
a build automation tool
5

A variable that can be modified from anywhere within a program is called a

A
global variable.
B
local variable.
C
specific variable.
D
general variable.
6

Which is a conditional statement?

A
If it is sunny, we can play ball.
B
It is sunny today.
C
It is sunny or rainy.
D
It is sunny across the street, but not sunny here.
7

What process is used to convert numbers between the binary system and the decimal system?

A
Enter the number in a calculator, divide by 2, and multiply by 10.
B
Convert each binary number to a letter, then use the letter’s place in the alphabet as the decimal representation ( e.g., A = 1, B = 2).
C
Add up the digits in the binary number and place the sum behind a decimal point.
D
Look up the number on a binary-to-decimal conversion table.
8

Which iteration must have an expression that has a true or false value?

A
a for loop
B
a while loop
C
a last variable loop
D
a break loop
9

A program contains the following statements: gradeIf : print (“You are an A student!”)What action will the program take when 89?

Question illustration
A
print “You are an A student!”
B
print “grade = 89”
C
print nothing
D
print “You are a B student!”
10

“Jan23” can be stored using which data type?

A
an alphanumeric string
B
a boolean operator
C
characters
D
floating point numbers
11

What is the name of a coding sequence that is executed multiple times in a program?

A
a break
B
a pass
C
a loop
D
a suite
12

In a student scheduling program, a variable HasFreePeriod is set as True or False. This variable is an example of

A
an abstract data type.
B
a user defined type.
C
an array.
D
a scalar.
13

A function is different from a procedure because a function

A
does not contain a set of instructions.
B
can have only a limited number of steps.
C
returns a value.
D
is mathematical.

Did you find these answers helpful?