Computer Science Midterm 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

What is x after the following statements? x = 2 x *= x + 3

10

The result of the expression 11.3 + 6.6 is ______________.

17.9

What is the output for y? y = 0 for i in range(2,9): y += i print(y)

35

After the execution of the following statement, the variable price will reference the value ________. price = int(68.549)

68

What is the output for the following line of code? print(format(76.15854, '.3f'))

76.159

The expression print(str(8) + str(9)) will output ___________.

89

The following code displays __________.

Adult

An _________ refers to a sequence of well defined steps to solve a problem.

Algorithm

In Line 9, x, y, and z are ______ used when calling the average function from main.

Arguments

__________ are the notes of explanation that document lines or sections of a program.

Comments

An _______ - a controlled loop causes a statement or set of statements to repeat as long as a condition is true.

Condition (While)

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

What is the result of the following boolean expression if x equals 5, y equals 3, and z equals 8? not(x < y or z > x) and y < z

False

What type of data is bring stored into the variable sold in the following line of code? sold = 256.752

Float

It is recommended that programmers should avoid using ________ variables in a program when possible.

Global

Line 1 is the function ________ for the function average.

Header

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

In Lines 2 & 3, avg is a _______ variable to the function average.

Local

In Line 1, first, second and third are _______ for the function average.

Parameters

What type of data is being stored into the variable a in the following line of code? a = input("Enter a number:")

String

What is the result of the following boolean expression, if x equals 5, y equals 3, and z equals 8? x < y or z > x

True

What will be displayed after the following loop terminates?

i is 6 isPrime is False

An ________ statement will execute one block of statements if its condition is true, or another block if its condition is false.

if-else


Ensembles d'études connexes

Chapter 1-Definition of Cognition

View Set

Assignment 11 - The Seven Signs: Signs 4-7 and the Seven Plagues

View Set

Life Insurance Policy Provisions

View Set

nurs 203 midterm prep u questions

View Set