PD Mock Quiz - (9) 1 PDF
PD Mock Quiz - (9) 1 PDF
a.
print ("Program
Design");
b. print [Program
Design]
c.
print ("""Program
Design""")
d. print ("Program
Design")
2. Which one of the following is the correct extension of the Python file?
a. .python
b. .py
c. .pn
d. .p
3. Which one of the following statements shows a valid declaration of a string variable in
Python?
a. d = Hi There
b. d = "Hi There"
c. d == [Hi There]
d. d = [Hi There]
a.
b.
c.
d.
a. print
("""Python, Java, C#""")
b. print
("Python", "Java", "C#")
c. print
("Python"), ("Java"),
("C#");
d.
print [Python, Java, C#]
6. Study the following Python code snippet and answer the question that follows:
a.
10
b.
67
c.
8
d.
2 8 12 67
7. Suppose myExample is [5, 8, 34, 76, 2, 56, 33], what is the result after myExample.pop(3)?
a.
[5, 8, 76, 2, 56, 33]
b.
[5, 34, 76, 2, 56, 33]
c.
[5, 8, 34, 2, 56, 33]
d.
[5, 8, 34, 76, 2, 33]
8. Which one of the following operators assigns a variable and returns the remainder?
Select one:
a. /=
b.
/
c.
%=
d.
\=
a.
123
b.
135
c.
12345
d.
111
10. Which one of the following operators is a valid comparison operator?
Select one:
a. !=
b.
AND
c. <<
d.
**
11. Which one of the following operators compares two values that are not equal to each
other?
a.
!=
b.
/=
c.
==
d.
>=
a.
Hello, Python!Hello, Python!
b.
Hello, Python!
c.
!nohtyP ,olleH!nohtyP ,olleH
d.
!nohtyP ,olleH
c.
Check spelling errors on the source code
14. Study the following Python code snippet and answer the question that follows:
a. Java
Python
Java
b.
Java
Python
c. Java
d.
Python
Python
Java
a.
[100, 200, 300, 400, 500, 600]
b.
[100, 200, 300, 400, 500, 600]
c.
[100, 200, 300, 400, 500, 600]
[100, 200, 300, 400, 500, 600, 600]
d.
[100, 200, 300, 400, 500]
[100, 200, 300, 400, 500, 600]
a.
1111
b.
5432
c.
1234
d. Error
17. Which one of the following commands is used to add a new element to a list?
a. mylist.a
ddEnd(5)
b. mylist.a
dd(5)
c. mylist.a
ddLast(5)
d. mylist.a
ppend(5)
18. The __________ character is used to compare two values if they are equal to each other.
a.
=
b.
==
c.
+
d.
=+
a.
Define
b. Def
c.
Fun
d.
Function
20. Study the following Python code snippet and answer the following question:
a.
[[7, 3, 9, 2, 5], [7, 3, 9, 2, 5]]
b.
[7, 3, 54, 2, 5]
c.
[[7, 3, 54, 2, 5], [7, 3, 54, 2, 5]]
d.
[[7, 54, 9, 2, 5], [7, 54, 9, 2, 5]]
21. What will be the output of the following Python code?
Select one:
a.
10
b.
10i
c.
20
d.
100
a. is always set to
None
b.
holds a reference to the currently processed object
d.
is set to a unique random value
a.
TRUE
FALSE
b.
TRUE
c.
FALSE
TRUE
d.
TRUE
FALSE
TRUE
24. Suppose myExample is [5, 8, 34, 76, 2, 56, 33], what is the result after myExample.pop(3)?
a.
[5, 8, 76, 2, 56, 33]
b.
[5, 34, 76, 2, 56, 33]
c.
[5, 8, 34, 2, 56, 33]
d.
[5, 8, 34, 76, 2, 33]
25. Given the following Python code snippet, what will be printed?
a. 3
b.
6
c.
Zuma
d.
pos Zuma
26. You are told accumulate the total sum of a list of numbers, which of the following
accumulator patterns would be appropriate to achieve the desired result?
a.
Block B
b.
Block A
c.
None of the above would be appropriate for the problem.
d.
Block C
a. 3
c. 15
d. 7
28. Given the following Python code snippet, what will be printed?
Select one:
a.
The course is Program Design course
b.
The course is course Program Design
c.
The course is course
d.
The course is Program Design
29. What will be the value of the i variable when the while e loop finishes its execution?
a. 1
b. the variable becomes unavailable.
c. 0
d. 2
a. True
b. False
c. None