Question: Question 1 1 pts def check _ negative ( num ) : if num < 0 : # Line 1 return the number is negative
Question pts
def checknegativenum:
if num : # Line
return "the number is negative" # Line
return "the number is positive" # Line
printthank you" # Line
printall done" # Line
checknegative
When the function checknegative is called, how many lines of the function body are executed? NOTE: do not count the function call and the function header
Group of answer choices
Flag question: Question
Question pts
Select all the correct options for determining if integer x is an even number.
Group of answer choices
if x :
printEven
if x :
printEven
if x :
printEven
if x :
printEven
Flag question: Question
Question pts
Which of the following code snippets will cause an error? Select all that apply.
subject CS
## Option
if subject CS :
printWelcome
printAwesome
## Option
if subject CS :
printWelcome
printAwesome
## Option
if subject CS :
printWelcome
printAwesome
## Option
printWelcome
if subject CS :
printAwesome
Group of answer choices
Option
Option
Option
Option
Flag question: Question
Question pts
Which of the following Python code snippets correctly categorizes a number based on the conditions below?
If the number is less than it prints "Low".
If the number is between and inclusive it prints "Medium".
If the number is greater than it prints "High".
Select all correct answers:
Group of answer choices
if number :
printLow
elif number and number :
printMedium
else:
printHigh
if number :
printLow
elif number and number :
printMedium
else:
printHigh
if number :
printLow
elif number and number :
printMedium
elif number :
printHigh
if number :
printLow
elif number and number :
printMedium
elif number :
printHigh
Flag question: Question
Question pts
Given the code below, what describes the values of the number x that will cause the code to print condition true Select all correct answers
if x or x :
printcondition true"
printall done"
Group of answer choices
All values of x
to both inclusive
None of the others
Any value of x less than
Flag question: Question
Question pts
Which of the following will give the same result as Gxy in all cases?
def Gx y:
if x:
return False
else:
if y:
return False
else:
return True
Group of answer choices
not x and not y
x or y
x y
x and y
Flag question: Question
Question pts
Which of the following condition correctly refactors the code block below?
def unfactoredxyz:
if x :
if y :
if z :
return True
Group of answer choices
x or y and z
x and y and z
x and y or z
x or y or z
Flag question: Question
Question pts
When given the same input, do the following functions always produce the same output?
Option :
def checkfunctionx y z:
return x or y or z
Option :
def checkagainx y z:
if x :
if y :
return True
else:
return False
else:
return False
Group of answer choices
The functions above will produce different outputs for some arguments.
The functions above will not run due to a syntax error.
The functions above will produce the same output for all arguments.
The functions above will not run if z due to a runtime error.
Flag question: Question
Question pts
Consider the following code:
x
total
while x :
total x
x
What will be the value of total after the loop finishes?
Group of answer choices
Flag question: Question
Question pts
What can replace the so that we get the desired output for this code? Select all correct options.
Code:
number
while :
printnumber
number
Output:
Group of answer choices
number
number
number
number
Flag question: Question
Question pts
Given the following code:
y intinputenter a number:
while y :
y y
printy
Which of the following inputs will result in an infinite loop?
Select all that apply.
Group of ans
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
