0% found this document useful (0 votes)
55 views

Quizz 1 With Solution

This document contains a quiz with 10 multiple choice questions covering basic Python concepts like data types, variables, operators, conditional statements, loops and functions. Each question is presented on its own page along with possible answer options.

Uploaded by

Deepesh Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views

Quizz 1 With Solution

This document contains a quiz with 10 multiple choice questions covering basic Python concepts like data types, variables, operators, conditional statements, loops and functions. Each question is presented on its own page along with possible answer options.

Uploaded by

Deepesh Suresh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Quiz Lesson 1

Page 1

1 You run the code below from the editor.


type(5)
print(3.0-1)

What's printed?

int

2.0
int then 2.0

2 Which is allowed in Python?

x+y=2
x*x = 2

2=x

xy = 2
None of the Above

Page 2

3 You run the code below from the file editor.


usa_gold = 46
uk_gold = 27
romania_gold = 1

total_gold = usa_gold + uk_gold + romania_gold


print(total_gold)

romania_gold += 1
print(total_gold)

What's printed?

74 then 74

74 then 75
74

75

Page 3

4 What is the value of the variable 'u' from the code below?
once = "umbr"
repeat = "ella"
u = once + (repeat+" ")*4

umbrella ella ella ella

umbrellaellaellaella

5 What does the code below print?


pset_time = 15
sleep_time = 8
print(sleep_time > pset_time)
derive = True
drink = False
both = drink and derive
print(both)

False then False

False then True


6 What does the code below print?
s = "6.00 is 6.0001 and 6.0002"
new_str = ""
new_str += s[-1]
new_str += s[0]
new_str += s[4::30]
new_str += s[13:10:-1]
print(new_str)

260000
26 100

7 What's printed when x = 0 and y = 5?


x = float(input("Enter a number for x: "))
y = float(input("Enter a number for y: "))
if x == y:
if y != 0:
print("x / y is", x/y)
elif x < y:
print("x is smaller")
else:
print("y is smaller")

x is smaller
y is smaller

8 What is printed when the below code is run?


mysum = 0
for i in range(5, 11, 2):
mysum += i
if mysum == 5:
break
mysum += 1
print(mysum)

9 How many times will the code below print "common letter"?
s1 = "mit u rock"
s2 = "i rule mit"
if len(s1) == len(s2):
for char1 in s1:
for char2 in s2:
if char1 == char2:
print("common letter")
break

02
4

10 Which function asks the user to provide information by typing it on the keyboard ?

input()
get()

scanf()
- GetLine()

Sans réponse

Fermer cette fenêtre

You might also like