ENGR 102 Exam
Tested Questions With Revised
Correct Detailed Answers
>Latest Update>>
1. What will be the output of the following python code?
X = 32
Y = 2
X /= X
X //= Y
print(X) - ANSWER
0.0
2. Which lines will be printed when the following Python code is ex...
1. What will be the output of the following python code?
X = 32
Y=2
X /= X
X //= Y
print(X) - ANSWER 0.0
2. Which lines will be printed when the following Python code is executed?
[Negative points for wrong answers]
x = 20
y = 10
z = 30
if x == 10:
print("Howdy 10")
if y == 20:print("Howdy 20")
else:print("Howdy 30")
elif y == 20:
3. What will the following Python code print to the console when executed?
x = 50
if not(x >= 10 and x <= 100):
print("Hello from the if block")
elif (x < 10 and x > 100):
print('Hello from elif block')
else:
print('Hello from the else block') - ANSWER Hello from the else block
4. When executed, what output does the following Python code produce?
if "cat" == "dog":
print("prrrr")
else:
print("ruff") - ANSWER ruff
,5. Find the output of the following python program:
how_many = 10
if how_many == 1 :
print("Single")
elif how_many == 2 :
print("Couple")
elif how_many < 5 :
print("Few")
elif how_many < 10 :
print("Several")
elif how_many > 10 :
print("Lots")
else:
print("None")
OPTIONS:
Few
None
Lots
Several - ANSWER None
6. To test if two variables are equal and positive below are two methods:
Method 1:
, ((variable1 == variable2) and (vairable1 > 0))
Method 2:
not ((variable1 != variable2) or (variable1 <= 0))
Qn: Are Method 1 and Method 2 equivalent?
True
False - ANSWER True
7. If we have to determine whether variable (A) is not zero, what is the correct
Python Syntax:
A/= 0
A \= 0
A -= 0
A != 0 - ANSWER A != 0
8. If more than one operator of equal precedence has to be evaluated, how does
the evaluation occur?
right to left
does not matter
left to right
no clue :) - ANSWER left to right
9. If True:
print("1")
print("8")
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller NURSINGDICTIONARY. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.