CS Chapter 1 review

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

not equal operator

!=

Syntax Test Logic

1.Design the program 2. Write the code 3. Correct S_____ errors 4.T_____ the program 5. Correct L_______ errors 6.Iterative development

relational operators

>,< and ==

RAM

A computer stores a program and the data that the program is working with in main memory while the program is running. Main memory is commonly known as:

False

A while loop is called a pretest loop because the condition is tested after the loop has had one iteration.

format(sales,'.2f') or print(format(sales,',.2f'))

Assume a variable sales references a float value. Write a statement that displays the value rounded to two decimal places

true false true false false

Assume that i = 1, j = 2, k = 3 and m = 2. What does each of the following conditions display? ( i >= 1 ) and ( j < 4 ) ( m <= 99 ) and ( k < m) ( j >= i ) or ( k == m ) ( k + m < j ) or ( 3 - j >= k ) not ( k > m )

False

Both of the following for clauses would generate the same number of loop iterations.for num in range(10):for num in range(1, 10):

152

Decimal Value of the following binary number : 10011000

False

In python an infinite loop usually occurs when the computer accesses an incorrect memory address

15

Largest value that can be stored in 4 bits

height = int (input('enter height in inches : '))

Python code that prompts the user to enter his or her height in inches and assigns the user's input to a variable named height

outside

There is square on the screen of size 100 and leftmost coordinate (100,100). The following code checks that the turtle is ____________ the square and hides the turtle.

False

To get the total number of iterations in a nested loop, add the number of iterations in the inner loop to the number in the outer loop.

2,4,6,8

What are the values that the variable num contains through the iterations of the following for loop?for num in range(2, 9, 2):

20.0

What i the output of the following command, given that value1 = 2.0 and value2 = 10? print(value1 * value2)

Machine language

What is the only language that a machine understands?

The path is D:\sample\test.

What is the output of the following print statement? print ('The path is D:\\sample\\test.')

0

What value represents a bit that is turned off?

counting counting counting counting

What will be displayed after the following code is executed? count = 4 while count <12: print("counting") count = count + 2

False

When an integer is divided by an integer the result will be a float

when continue refers to a value equal to 10

When will the following loop terminate?while continue != 10:

Assembly language

Which language is referred to as low-level language

if not(turtle.isdown()) : turtle.pendown()

Which of the following will determine if the turtle's pen is up and will change it to down if that is the case?

print(format(0.2, '.0%'))<enter>

Which of the following will display 20 %? print(format(0.2 * 100, '.0%')) <enter> print(format(0.2, '.0%')) <enter>

if points > 0 and points < 50 : print("Valid") else: print("Invalid")

Write an if-else statement that determines whether the points variable is outside the range of o to 50. If the variable's value is outside this range it should display "Invalid." Otherwise, it should display "Valid."

number = float(input('Enter a positive nonzero number: ')) while number <= 0: print('That is an invalid value.') number = float(input('Enter a positive nonzero number: ')) print ('Thanks!')

Write code that prompts the user to enter a positive nonzero decimal number and validates the input.

if amount1 > 10 and amount2 < 100: if amount1 > amount2: print (amount1) elif amount2 > amount1: print (amount2) else: print('Both values are the same.')

Write nested decision structures that perform the following: If amount1 is greater than 10 and amount2 is less than 100, display the greater of amount1 and amount2.

Input Validation

________ is the process of inspecting data that has been input into a program in order to ensure that the data is valid before it is used in a computation.

true

a decision structure can be nested inside another decision structure

Interpreter

a program that both translates and executes the instructions in a high-level language program

when the condition is true

an action in a single alternative decision structure is performed under these circumstances

if statement

causes one or more statements to execute only when a Boolean expression is true

Unicode

extensive encoding scheme that can

30

for num in range(0, 20, 5): num += num print(num)

false

in python math expressions are always evaluated from left to right, no matter what the operators are

true

in python print statements written on separate lines do not necessarily output on separate lines

sentinel

is a special value that marks the end of a sequence of items

or, and

logical operators that perform short-circuit evaluation

compound expression

made up of two or more Boolean expressions

assignment statement

makes a variable reference a value in the computer's memory

or operator

one or both of the subexpressions must be true for the compound expression to be true

12.45 + 3.6 the values to the right and left of the + symbol are the

operands

Fetch-Decode-Execute Cycle

process that is used by the CPU to execute instructions in a program

false

python formats all floating point numbers to two decimal places when outputting with the print statement

if else statement

special version of a decision structure which makes the logic of the nested decision structure simpler to write

mod

the % symbol is the remainder operator and is also known as what operator?

6

total = 0 for count in range(1,4): total +=count print(total)

true

what is the result of the following Boolean expression, given that x = 5 y = 3 and z = 8


Set pelajaran terkait

Life Insurance - Chapter 9: Group Life Insurance, Retirement Plans, and Social Security Disability Program

View Set

Information Systems Final Exam Study Guide (Textbook Material)

View Set

PN 2006 pre lec/quizzes/midterm review

View Set

Ancient China Neolithic-to-Xia-Shang-Zhou-Qin

View Set

Public Speaking 1315 Final Review Chapters 8-13

View Set

lesson 1.2 elements, compounds, and Mixtures

View Set