coding

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

Which of the following Python programs will not run? 1)x = 4 y = 5 print x + y 2)x = 4 y = "hi" print x + y 3)x = 4 y = 5.5 print x + y 4)x = 4 print x + 5

2

Suppose you run the following Python program: x = input("Enter some text: ") print x While the program is running, after the prompt has been printed, the user types the following and presses Enter: Delaware ratified the U.S. Constitution in 1787. What does the program print? 1)Delaware ratified the U.S. Constitution in 1787. 2)Delaware ratified the U.S. Constitution in 3)Delaware 4)(The program does not print anything.)

1

What does the following Python code display? print "Hello" print "World" 1)Hello World 2)HelloWorld 3)Hello World 4)Hello World

1

What is the type of the variable x in the following Python program? x = input("Enter something: ") 1)string 2)integer 3)float 4)The type cannot be determined.

1

Which of the following is NOT a valid type of comment in Python? 1)%% This is a comment 2)# This is a comment 3)""" This is a comment """

1

What does the following Python program print? x = 9 + 6 / 3 * 2 - 1 print x 1)9 2)12 3)15 4)21

2

Which Python code segment will display "Hello, world!" on the screen? 1)display Hello, world! 2)print "Hello, world!" 3)print Hello, world! 4)"Hello, world!"

2

What does the following Python program print? x = "I am" y = 6 z = "feet tall" print x print y print z 1)I am 6 feet tall 2)I am6feet tall 3)I am 6 feet tall 4)x y z

3

What type is the following variable? x = "Hi there" 1)float 2)integer 3)boolean 4)string

4

Which of the following is NOT a program that will produce the following output? hellohellohello 1)var = "hello" * 3 print var 2)var = "hello" + "hello" + "hello" print var 3)var = "hello" print var print var print var 4)In the following code, assume the user enters 3. num_times = int(input("How many times?: ")) var = "hello" * num_times print var

3

Which of the following operations will output a value of 5? 1)11/2 2)11.0/2 3)float(11)/2 4)2 + 3 * 2

1

Which of the following best describes the main purpose of comments? 1)Comments create better spacing in programs. 2)Comments describe your program so other people can read it more easily. 3)Comments warn the people running the program about potential problems with the program.

2


Set pelajaran terkait

SPA3 (15.2 Part #2 with haber [Test #4])

View Set

Chapter 7. Management and Leadership

View Set

Chapter 27: Children and Adolescences

View Set

PA Driver's manual Chapter 3: Learning to Drive and Safety (Part 1)

View Set

Chapter 25: Care of patients with skin problems

View Set

10. Salt marshes and mangrove forests

View Set