0% found this document useful (0 votes)
78 views4 pages

Lesson03 QUIZ

This document contains a 20 question quiz on operators in Python. The quiz contains multiple choice, matching, and code snippet questions. It provides instructions to write answers legibly in blue or black pen with no erasures. Students are to fill in their name, course details, score, and instructor name for a prelim quiz on lesson 2 operators in Python.

Uploaded by

Andrjstne Sales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views4 pages

Lesson03 QUIZ

This document contains a 20 question quiz on operators in Python. The quiz contains multiple choice, matching, and code snippet questions. It provides instructions to write answers legibly in blue or black pen with no erasures. Students are to fill in their name, course details, score, and instructor name for a prelim quiz on lesson 2 operators in Python.

Uploaded by

Andrjstne Sales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Subject Code : IT ELEC03

1 | Page Descriptive Title: ITE Elective 3 (Python Programming)

PRELIM QUIZ02: LESSON 02-Operators in Python


General Instructions:
● Turn off your cell phone/s. Use of CP is not allowed during exam.
● Write ALL YOUR ANSWERS legibly.
● Use blue or black pen only. Strictly: NO ERASURE.
● READ and FOLLOW the DIRECTIONS carefully!

Multiple Choice
Identify the choice that best completes the statement or answers the question.

____ 1. What is the result of the expression 15//2?


a. 7.7 c. 7
b. 1 d. 30

____ 2. Which of the following function convert a String to a list in python?


a. list(s) c. repr(x)
b. eval(str) d. tuple(s)
____ 3. What is the Python prompt?
a. // c. >>
b. >>> d. #
____ 4. Which of the following function convert an integer to an unicode character in python?
a. ord(x) c. oct(x)
b. hex(x) d. unichr(x)
____ 5. Which of the following operator in python evaluates to true if it does not finds a variable in the specified
sequence and false otherwise?
a. is c. not in
b. // d. **

MATCHING
Base from the following: Match the following to the items below.

a = 20 a. aaa e. XXX
b. YYY f. ddd
b = 10 c. bbb g. eee
d. ccc h. fff
c = 15

d=5
____ 9.
e=0
a = 50

b = 30
Match the following to the items
if ( a is b ):
below.
print "aaa"
a. 415 f. 125
b. 51 g. 150 else:
c. 90 h. 55
d. 302 i. 335 print "bbb"
e. 660
What will be printed in the code listings above?

____ 6. e = (a * b + a ) * c
/d ____ 10.

What is the value of e? a = 50

b = 90
____ 7. e=b+d+a+a*
if ( a is not b ):
c
print "eee"
What is the value of e?

1 | Page Reference: Python Programming Language, tutorialspoints simply easy learning


Python Programming in Context 2e, Miller, Ranum
Subject Code : IT ELEC03
2 | Page Descriptive Title: ITE Elective 3 (Python Programming)
else:
____ 8. e=b+d*a+c print "fff"
What is the value of e?

What will be printed in the code listings above?

____ 11.

a = 20

b = 30

if ( a is b ):

print "XXX"

else:

print "YYY"

What will be printed in the code listings above?

Case Analsysis:
Consider the following sequence of assignment statements:
>>> a = 10
>>> b = 20
>>> a = b
Match the following to the items below.
a. b d. 0
b. 10 e. 30
c. 20
____ 12. What is the value of a after the first line?

Match the following to the items below.


a. >>> 18 * 17 // 2 e. >>> 18 // 17 * 2
153 155
b. >>> 4/3 * 3.1415 * 1*****3 f. >>> 10\\2 * 12\\2
4.1886666666666663 50
c. >>> 10//2 * 12//2 g. >>> 4/3 * 3.1415 * 1**3
30 4.1886666666666663
d. >>> 1.3 * 15 h. >>> 1/3 * 15
6.0 5.0
____ 13. Compute the number of handshakes required to shake all the hands of
your classmates. Assuming that you have 18 classmates:
____ 14. Find the volume of a sphere with a radius of 1 using the formula
4/3 pi r3
____ 15. Compute the number of 2 ft square tiles to cover the floor of a 10 by
12 ft room.
____ 16. Compute 1/3 of 15.

Base from the following:


a = 21
b = 10
c=0

Match the following to the items below.


a. 0 d. 8
b. 31 e. 21
c. 2 f. 10
____ 17. c =2
2 | Page Reference: Python Programming Language, tutorialspoints simply easy learning
Python Programming in Context 2e, Miller, Ranum
Subject Code : IT ELEC03
3 | Page Descriptive Title: ITE Elective 3 (Python Programming)
a =3
c **= a
print "The value of c is ", c
____ 18. c += a
print "The value of c is ", c
____ 19. c =2
a =5
c *= a
print "The value of c is ", c
____ 20. c =2
c %= a
print "The value of c is ", c

--------------------------------------------------------------------------------------------
PRELIM QUIZ02
Name : ____________________________
Course, Year and Block : ____________________________
Subject Code : ____________________________
Date : ____________________________ SCORE: _____________
Name of Instructor : ____________________________

3 | Page Reference: Python Programming Language, tutorialspoints simply easy learning


Python Programming in Context 2e, Miller, Ranum
Subject Code : IT ELEC03
1 | Page Descriptive Title: ITE Elective 3 (Python Programming)

1 | Page Reference: Python Programming Language, tutorialspoints simply easy learning


Python Programming in Context 2e, Miller, Ranum

You might also like