PROGRAMMING 3300

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Output? for i in (0, 25, 5): print(i)

0 25 5

What will the output of the following code be if the user enters 3 at the prompt? your_num = int(input("Enter a number:")) while (your_num > 0): product = your_num * 5 print(your_num, " * 5 = ", product) your_num -= 1

3*5=15 2*5=10 1*5=5

What is the output? for i in range(0, 25, 5): i += 2 print('hello') hello hello hello hello hello

5 Hellos

What is the binary value of the following decimal number? 118 a. 01110110 b. 11001000 c. 00111001 d. 01110101

A

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.") a. 1 3 9 The loop has ended. c. 1 3 9 12 15 18 The loop has ended. b. 1 3 9 The loop has ended. d. 1 3 9 The loop has ended.

A

Where does a computer store a program and the data that the program is working with while the program is running? a. in main memory b. in the CPU c. in secondary storage d. in the microprocessor

A

Which computer language uses short words known as mnemonics for writing programs? a. Assembly b. Java c. Pascal d. Visual Basic

A

Which of the following is the correct if clause to determine whether choice is anything other than 10? a. if choice != 10: b. if choice != 10 c. if choice <> 10: d. if not(choice < 10 and choice > 10):

A

Which of the following will hide the turtle if it is visible? A. if turtle.isvisible(): turtle.hideturtle() B. if turtle.isvisible(): turtle.invisible() C. if turtle.isvisible turtle.hideturtle() D. turtle.isvisible(): turtle.hide()

A.

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=", ") a. 10, c. 1, 3, 6, 10, 16, b. 1, 3, 6, 10, d. 1, 2, 3, 4, 5,

B.

The following is an example of an instruction written in which computer language? 10110000 a. Assembly language b. Java c. machine language d. C#

C

The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level language.

False- Interpreter

What will the following statement displays? print('George', 'John' , 'Paul', 'Ringo' , sep='@')

George@John@Paul@Ringo

Programs are commonly referred to as a. system software b. software c. application software d. utility programs

Software

IDLE is an alternative method to using a text editor to write, execute, and test a Python program.

True

What is the decimal value of the following binary number? 10011101 a. 157 b. 8 c. 156 d. 28

a

When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true. a.or b.and c.not d.Maybe

a

Which of the following is the correct if clause to determine whether y is in the range 10 through 50, inclusive? a if y >= 10 and y <= 50: b if 10 < y or y > 50: c if 10 > y and y < 50: d if y >= 10 or y <= 50:

a

Which type of error prevents the program from running? a. syntax b. human c. grammatical d. logical

a

The following code snippet will change the turtle's pen size to 4 if it is presently less than 4: if turtle.pensize() < 4: turtle.pensize(4) a.True b.False

a.

What is the result of the following Boolean expression, given that x = 5, y = 3, and z = 8? x < y or z > x a. True b. False c. 8 d. 5

a.

What is the result of the following Boolean expression, given that x = 5, y = 3, and z= 8? not (x < y or z > x) and y < z a. False b. True c. 8 d. 5

a.

Which logical operators perform short-circuit evaluation? a.or, and b.or, not c.not, and d.and, or, not

a.

A(n) __________ structure is a logical design that controls the order in which a set of statements execute. a.function b.control c.sequence d.Iteration

b

The following statement will check to see if the turtle's pen color is 'green': if turtle.pencolor() = 'green' a. True b. False

b

The process known as the __________ cycle is used by the CPU to execute instructions in a program. a. decode-fetch-execute b. decode-execute-fetch c. fetch-decode-execute d. fetch-execute-decode

c

How many times will "Hi again!" be displayed after the following code executes? for i in range(0, 12, 2): print("Hi, again!") a. 2 b. 12 c. 5 d. 6

d.

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

height = int(input('Enter your height: '))

What is the output? i = 0 while i < 25: i = i + 5 print('hello')

hello hello hello hello hello

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

print(format(sales, '.2f')) Sales = 90.899 print(format(sales, '.2f')) print('{:.2f}'.format(sales)) print('%.2f'%sales)


संबंधित स्टडी सेट्स

Holistic Assessment Exam #3 Practice

View Set

principle events of the ovarian and uterine cycles

View Set

Supply Chain: Chapter 9 Questions

View Set

AP GOV- unit 4 progress check REAL

View Set