Prelim Examination ITELEC3 - ITE ELECTIVE03 (Python Programming)

You might also like

You are on page 1of 7

COLEGIO DE DAGUPAN

Arellano St., Dagupan City


PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
PLEASE WRITE YOUR NAME HERE ↓
Instructions: Name: Sales, Andrei Justine V.
Turn off your cell phone/s. Use of CP is not allowed during exam. Course, Year and Block: 41-ITE01
Write ALL YOUR ANSWERS legibly on your TEST BOOKLET. Subject Code & Description: ITELEC3 –ITE ELECTIVE 3
Use blue or black pen only. Strictly: NO ERASURE. ___________________________________________
READ and FOLLOW the DIRECTIONS carefully! Date: October 9, 2020

SET 02
MATCHING

Match the following to the items below.


a. 1 2 3 4 f. 6
7
8
9
b. 5 g. 6
6 7
7 8
8 9
9 10
c. 10 9 8 7 6 h. 20
21
22
23
24
d. 1 2 3 4 5 i. 20
21
22
23
24
25
e. 10 9 8 7 6 5

H 1. What would be the output from the following Python code segment?
for x in range(20,25):
print x
B 2. What would be the output from the following Python code segment?
for i in range(5,10):
print i
A 3. What would be the output from the following Python code segment?
x=1
while x<5:
print x,
x+=1

Match the following to the items below.


a. Extendable e. Databases
b. Interactive Mode f. Easy-to-maintain
c. Portable g. GUI Programming
d. A broad standard library h. Scalable
H 4. Python provides a better structure and support for large programs than shell scripting.
A 5. It is a Python feature which states that you can add low-level modules to the Python interpreter. These modules enable
programmers to add to or customize their tools to be more efficient.
F 6. It is a Python feature which states that Python's source code is fairly easy-to-maintain.
C 7. It is a Python feature which states that Python can run on a wide variety of hardware platforms and has the same interface on all
platforms.
D 8. It is a Python feature which states that Python's bulk of the library is very portable and cross-platform compatible on UNIX,
Windows, and Macintosh.
Match the following to the items below.
a. ( 'abcd', 786 , 2.23, 'john', 70.2 ) e. (786, 2.23)
b. Yes f. No
c. el g. llo
d. Easy-to-learn h. Easy-to-read:
C 9. What is the output of print tuple[1:3] if tuple = “Hello World!”
D 10. It is a Python feature which means that Python has few keywords, simple structure, and a clearly defined syntax.

/caerlangm PRELIM EXAMINATION Page 1 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
G 11. What is the output of print str[2:5] if str = 'Hello World!'?
Base from the following:
a = 20
b = 10
c = 15
d=5
e=0

Match the following to the items below.


a. 415 f. 125
b. 51 g. 150
c. 90 h. 55
d. 302 i. 335
e. 660

C 12. e = (a + b) * c / d #( 30 * 15 ) / 5
The value of e is?
H 13. e=b/d*a+c
What is the value of e?
I 14. e=b+d+a+a*c
What is the value of e?
F 15. e=b+d*a+c
What is the value of e?
E_ 16. e = (a * b + a ) * c / d
What is the value of e?
B 17. e=b*d+a/c
print "What is the value of e?", e
G 18. e = (a + b + a ) * c / d
What is the value of e?
D 19. e=b/d+a*c
print "What is the value of e?", e

Match the following to the items below.


a. # f. “ ” (double-quotes)
b. whitespaces g. blockspaces
c. \ h. { } (braces)
d. ‘ (single-quote) i. multiline
e. /

C 20. It is the line continuation character in Python.


I 21. In an interactive interpreter session, you must enter an empty physical line to terminate a ________ statement.
A 22. Comments in Python uses the ___ character.

Match the following to the items below.


a. pass statement d. breaking loop
b. nested loop e. for loop
c. break statement f. continue statement
F 23. Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating.
B 24. Python programming language allows to use one loop inside another loop.
E 25. It has the ability to iterate over the items of any sequence, such as a list or a string.

Match the following to the items below.


a. True f. numbers
b. Four g. False
c. characters h. Lists
d. Five i. Tuples
e. Six

B 26. Python supports ____ different numerical types:


D 27. How many standard data types does Python have?
H 28. _____ are the most versatile of Python's compound data types.

/caerlangm PRELIM EXAMINATION Page 2 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
Match the following to the items below.
a. Chester d. Mark
b. Kath e. Jhong
c. Haji

A 29. What will be printed on-screen after evaluating the following Python code?
intID = 1
if intID == 1:
print "Chester"
elif intID == 2 | intID == 3:
print "Mark"
elif intID == 4:
print "Jhong"
else:
print "Haji"
D 30. What will be printed on-screen after evaluating the following Python code?
intID=3
if intID == 1:
print "Chester"
elif intID == 2 | intID == 3:
print "Mark"
elif intID == 4:
print "Jhong"
else:
print "Haji"

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
F 31.
c =2
a =5
c *= a
print "The value of c is ", c
D 32.
c =2
a =3
c **= a
print "The value of c is ", c

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
_C 33. Compute the number of 2 ft square tiles to cover the floor of a 10 by
12 ft room.
G 34. Find the volume of a sphere with a radius of 1 using the formula
4/3 pi r3

Match the following to the items below.


a. .python g. Interactive Mode Programming
b. Script Mode Programming h. language
c. F5 i. private
d. variable j. public
e. .py k. weak
f. F2 l. strong
D 35. A Python identifier is a name used to identify a ______, function, class, module, or other object.
C 36. To run a script. go to Run menu and select Run Module, or simply press ___.

/caerlangm PRELIM EXAMINATION Page 3 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
G 37. It is a programming mode where interpreter is invoke without passing a script file as a parameter.

/caerlangm PRELIM EXAMINATION Page 4 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
Match the following to the items below.

a. strange d. even
b. odd e. mindreader
c. lower f. higher
B 38. What will be printed on-screen after evaluating the following Python code?
guess=5;answer=5
if guess < answer:
print 'higher'
elif guess > answer:
print ' lower'
else: # guess == answer
print 'mindreader!!!'
B 39. What will be printed on-screen after evaluating the following Python code?
number=5
test = number % 2
if test == 0:
print "even"
elif test == 1:
print "odd"
else:
print "strange"

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

A 40. What is the value of a after the first line?

Match the following to the items below.


a. aaa e. XXX
b. YYY f. ddd
c. bbb g. eee
d. ccc h. fff
G 41. a = 50
b = 90
if ( a is not b ):
print "eee"
else:
print "fff"

What will be printed in the code listings above?

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

D 42. Which of the following is correct about Python?


a. Python is designed to be highly readable. c. Python is a high-level, interpreted, interactive and
object-oriented scripting language.
b. It uses English keywords frequently where as d. All of the choices.
other languages use punctuation, and it has
fewer syntactical constructions than other
languages.
B___ 43. What is the output of print str[2:5] if str = 'Hello World!'?
a. H c. None of the choices.
b. llo World! d. llo

B 44. What is the result of the expression 15/2?


a. 7 c. 7.5
b. 1 d. 8
B 45. What is the output of print list[1:3] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?
a. [ 'abcd', 786 , 2.23, 'john', 70.2 ] c. abcd

/caerlangm PRELIM EXAMINATION Page 5 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
b. [786, 2.23] d. None of the choices.

/caerlangm PRELIM EXAMINATION Page 6 of 7


Education is a key to success!
COLEGIO DE DAGUPAN
Arellano St., Dagupan City
PRELIM EXAMINATION
ITELEC3 - ITE ELECTIVE03 (Python Programming)
SET 02
C 46. What is the Python prompt?

a. // c. >>>
b. # d. >>
B 47. What is the result of the expression 15//2?
a. 1 c. 7.7
b. 7 d. 30
D 48. Which of the following function convert a String to a list in python?
a. repr(x) c. tuple(s)
b. eval(str) d. list(s)
B 49. Which of the following function convert an integer to an unicode character in python?
a. ord(x) c. oct(x)
b. unichr(x) d. hex(x)
D 50. 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. // c. **
b. is d. not in

Prepared By:

JAN MICHAEL P. CAERLANG


SITE INSTRUCTOR

/caerlangm PRELIM EXAMINATION Page 7 of 7


Education is a key to success!

You might also like