Part 1 Cumulative Exam (Mod 1 - 5)

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

time = 3 while True: ---print('time is', time) ---if time == 3: ------time = 4 ---else: ------break What is the output from running the above code most like?

"time is 3" & "time is 4"

If book_title = "The Xylophone Case", which code will return False?

"x" in book_title & book_title.startswith("x")

Which of the following is a valid Python comment structure?

# comment

What is the order of precedence (from first to last) of the math operators?

*, /, +, - (MDAS)

Which operator can be used to combine two strings?

+

Which of the following statements is true?

Python variables are case sensitive

What is the output of the following code? print("She said, \"Who's there?\"")

She said, "Who's there?"

What does the input() function return?

a string value

What is the output of the following code? name = 123 if name.startswith("a"): ---print("welcome") else: ---print("please wait")

an error message

Which is a Python method of getting numeric input that can be used in math?

num1 = int(input("enter a number"))

Which of the following is a Python function?

print()

What will be displayed by the following code? count = 0 while count < 5: ---print("Hello", end = " ") ---count +=1

Hello Hello Hello Hello Hello

What does the Python code: score = 3 + "45" result in?

TypeError

Which statements evaluate True and without errors? (Choose all that apply.)

"The Title".istitle() & "upper".islower()

x = 0 while x < 5: ---x += 1 ---print('loop') What is the output from running the above code most like?

"loop" (5 times)

The most secure way for a company to store passwords is

Hashing plus Salt.

num_1 = "" num_temp = "" num_final = "" while True: ---num_1 = input("Enter an integer: ") ---if num_1.isdigit(): -------num_final = num_temp + num_1 ------num_temp = num_final ---else: ------print(num_final) ------break What is the output, when running the above code, if the user plans to enter input in the following order at the "Enter an Integer:" prompt? 1st input: 3 2nd input: 4 3rd input: five 4th input: 6

The output str would be: 34

What is "print" used for?

To display output

A passphrase (ex. 1st 2 characters of each word) is a good way to create a strong password.

True

A program that is designed to reproduce itself by copying itself into other programs without the user's knowledge is called a virus.

True

What are the advantages of creating and using functions in code?

code reuse & make testing easier

A strong password should:

have a random mixture of letters and other characters.

Given the following string: s = "Welcome" which code results in an error?

print(s + 1)

Given the code below and entering "Colette" for user_name input: total_cost = 22.95 user_name = input("Enter your name: ") Choose the print statement that will output: Colette - the total is $ 22.95 for today's purchase

print(user_name, "- the total is $", total_cost, "for today's purchase")

x = 3 y = "3" # get_diff takes an int and a str def get_diff(xint, ystr): ---# <function code needed here> To make this program work, returning sum of x & y, choose the best code to replace the above comment "# <function code needed here> " in the get_diff function

return int(ystr) - xint


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

MATC: Windows Server 1: Module 6_QUIZ

View Set

NUR 150 Unit 3 Pharmacology-PrepU

View Set

OB EXAM Female Partner Abuse/ Intimate Partner Violence

View Set

BSC2086 Chapter 23 Homework Assignment on Respiratory System

View Set

MO Health and Life Insurance Exam

View Set

Integumentary Management Davis Ch.29

View Set

Midterm Check Your Understanding

View Set