Programming Exam 1
Which of the following is the correct if clause to determine whether choice is anything other than 10
!=10
What is the binary vaule of the following decimal number 118
01110110
What will be displayed after the following code is executed? counter = 1 while counter <= 20: print(counter, end=" ") counter *= 3 print("\nThe loop has ended.")
1 3 9 The loop has ended
For the following code, what will the result be if the user enters 5 at the prompt? sum = 0 end_value = int(input("Enter a number: ")) for i in range(1, end_value): sum = sum + i print(sum, end=", ")
1,3,6,10
What is the decimal value of the following binary number 10011101
157
How many times will "Hi again!" be displayed after the following code executes? for i in range(0, 12, 2): print("Hi, again!")
6
Which computer languages uses short words known as mnemonics for writing programs?
Assembly
An _____ structure is a logical design that controls the order in which a set of statements execute.
Control
Pseudocode
Fake code
The Python Language uses a compiler which is a program that both translates and executes the instructions in a high level language.
False
What is the result of the following Boolean Expression x=5 y=3 z=8 (x<y or z>x) and y <z
False
The process known as the ____ cycle is used by the CPU to execute instructions in a program.
Fetch-decode-execute
What will the following statement displays? print('George', 'John' , 'Paul', 'Ringo' , sep='@') print
George@John@Paul@Ringo
The following is an example of an instruction written in which computer language 10110000
Machine Language
Where does a computer store a program and the data that the program is working with while the program is running?
Main Memory
Programs are commonly referred to as
Software
Which type of error prevents the program from running?
Syntax
IDLE is an alternative method to using a text editor to write execute and test a Python program
True
The following code snippet will change the turtles pen size to 4 if it is presently less than 4: turtle.pensize() <4
True
The following statement will check to see if the turtle's pen color is "green" if turtle.pencolor()= "green"
false
Pyhton code were user require to enter height
height= int(input("Enter your height: '))
Fetch-Decode-Execute
known as the cpu cycle
When using the ___ logical operator, one or both of the subexpressions must be true for the compound expression to be true
or
Which logical operatiors perfrom short- circuit evaluation?
or, and
Assume the variable sales regrences a float vaule.
print(format(Sales, '.2f)
What is the result of the following Boolean Expression, given that x=5,y=3 and z=8 x<y or z>8
true
Which of the following will hide the turtle if it is visible?
turtle.isvisble(): turtle.hideturtle()
Which of the following is the correct if clause to determine whether y is in the range 10 through 50?
y>=10 & y<=50: