PE1 Summary Test-Questions and Answers 100%Correct
73 views 0 purchase
Course
Programming for python language..
Institution
Programming For Python Language..
PE1 Summary Test-Questions and Answers 100%Correct
How many stars(*) will the following snippet send to the console?
i = 0
while i < i+2 :
i += 1
print("*")
else:
print("*") - ANSWER-the snippet will enter an infinite loop, printing one star per line
What is the output for the fol...
PE1 Summary Test-Questions and Answers 100%Correct
How many stars(*) will the following snippet send to the console?
i = 0
while i < i+2 : i += 1 print("*")
else: print("*") - ANSWER-the snippet will enter an infinite loop, printing one star per line
What is the output for the following piece of code?
x = 1
y = 2
x, y, z = x, x, y
z, y, z, = x, y ,z
print(x, y, z) - ANSWER-1 1 2
How many hashes(#) will the following snippet send to the console?
lst = [[x for x in range (3)] for y range in (3)]
for r in range (3): for c in range (3): if lst [r][c] % 2 != 0: print("#") - ANSWER-three
What is the output of the following piece of code if the user enters two lines containing 3
and 2 respectively?
x = int(input())
y = int(input())
x = x % y
x = x % y
y = y % x
print(y) - ANSWER-0
The meaning of a positional argument is determined by: - ANSWER-its position within the argument list What is the output of the following piece of code?
x = 1 // 5 + print(x) - ANSWER-0.2
What is the output of the following snippet?
def fun(inp=2, out=3) : return inp * out
print(fun(out=2) - ANSWER-4
The following snippet:
def func(a, b): return b ** a
print(func(b=2, 2)) - ANSWER-is erroneous
What is the output of the following piece of code if the user enters two lines containing 3
and 6 respectively?
y = input()
x = input()
print(x + y) - ANSWER-63
Take a look at the snippet, and choose the true statement: nums = [1, 2, 3] vals = nums del vals[ : ] - ANSWER-nums and vals have the same length
Which of the following lines correctly invoke the function below? (select two answers)
def fun(a, b, c=0): # Body of the function. - ANSWER-fun (0, 1, 2)
fun (b=0, a=0)
Assuming that my_tuple is a correctly created tuple, the fact that tuples are immutable means that the following instruction:
my_tuple [ 1 ] = my_tuple [ 1 ] +my_tuple [ 0 ] - ANSWER-is illegal
What is the output of the following snippet:
dct = {'one': 'two' , 'three': 'one', 'two': 'three'}
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 EricMatt. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.