You are on page 1of 12

Questions opt1 opt2 opt3 opt4 opt5 opt6 Answer

The
____is
elif els ell eif elif
short for
else if.

In
____loop,
test
expressio for while do if while
n is
checked
first

We can
generate a
sequence
of
call() range() list() tuple() range()
numbers
using
_____fun
ction

_____stat
ements
can alter Continue Break label list Break
the flow
of a loop.

___termi
nates the
current
iteration
and
transfer
continue break list tuple continue
the
control to
the next
iteration
in the
loop.
______op
erators
Assignm Arithmet Relationa
are and, Logical Logical
ent ic l
or, not
operators

Function
is the
ability to
call one
Decomp Integrati Composi Definitio Composi
function
osition on tion n tion
from
within
another
function

A _____
is a
function
paramete
that method class keyword method
r
“belongs
to” an
object

Which
one of the
following
if (a >= if (a => if a >=
is a valid if a>=2 : if a>=2 :
2) 22) 22
Python if
statement
?

Keyword
No loop Keyword "continue Keyword
Which of can be "break" " is used "break"
Loops
the used to can be to can be
should
following iterate used to continue used to
be ended
is True through bring with the bring
with
regarding the control remainin control
keyword
loops in elements out of the g out of the
"end".
Python? of current statement current
strings. loop. s inside loop.
the loop
A loop
A loop A loop
What is that A loop A loop
that that will
an infinite functions that runs that runs
never never
loop? infinitely forever forever
starts function
well

If the else
statement
is used
with a
while
loop, the
else
1 0 Infinite Null 0
statement
is
executed
when the
condition
becomes
_______.

Python
program
ming
language
allows to
use one
switch foreach nested forall nested
loop
inside
another
loop
known
as___

The
_____
statement
terminate break continue pass stop break
s the loop
containin
g it.
The_____
___
statement
is used to
skip the
rest of the
code break continue pass stop continue
inside a
loop for
the
current
iteration
only

Which of
the
following
keyword
is a valid
break continue pass body pass
placehold
er for
body of
the
function ?

Given a
string s =
"Welcom
e", which print(s[0] print(s.lo print(s.st
s[1] = 'r' s[1] = 'r'
of the ) wer()) rip())
following
code is
incorrect?

Given a
string s =
"Program
ming is
1 2 3 4 4
fun",
what is
s.find('ra
m')?
Given a
string s =
"Program
ming is
fun", 0 1 1 0 1
what is
s.startswit
h('Progra
m')?

The
_______
operator
is a string
& * % # %
operator
called the
format
operator

_______
function
you can
iterate
through
the
sequence
and
enumerat enumerat
retrieve enum() e() eindex()
e() e()
the index
position
and its
correspon
ding
value at
the same
time.
_______
finds all
the
occurrenc
es of
find() finditer() replace() check() finditer()
match
and return
them as
an
iterator.

Invoking
the
________
___
toString(
method encode() decode() convert() decode()
)
converts
raw byte
data to a
string.

The
readlines( a list of
) method a list of single a list of a list of
str
returns a lines character integers lines
________ s
____.

The
keyword
________
__ is def return class all class
required
to define
a class.
A
_______i
s an
ordered
collection dictionari
function sequence tuple sequence
of items, es
indexed
by
positive
integers.

_______a
dictionari dictionari
re sequence tuple list
es es
unordered
sets.

A ____
sign is the
beginning dollar colon hash slash hash
of a
comment

Which of
the
following print("sm print("sm print("sm print("sm print("sm
statement ith\ ith\\ ith\"exa ith"\ ith\\
prints exam1\ exam1\\ m1\"test. exam1"\ exam1\\
smith\ test.txt") test.txt") txt") test.txt") test.txt")
exam1\
test.txt?

The
Unicode
of 'a' is
97. What 96 97 98 99 99
is the
Unicode
for 'c'?
What is
the output
of the
following
program :
i=0
02132 01234 10243
while i < Error Error
4 5 5
3:
print
i
i++
print
i+1

What is
the output
of the
code
shown
below?
def f(x):
No No
yield Error test test1012
output output
x+1

print("test
")
yield
x+2
g=f(9)

What is
the output
of the
code
shown
below?
Error 100 101 99 100
def f1():
x=100
print(x)
x=+1
f1()
What is
the output
of the
following
code?

def foo():
12 1 2 none 12
try:

print(1)
finally:

print(2)
foo()

Which of
the
following
function shuffle(ls capitalize capitalize
isdigit()
capitalize t) () isalnum() ()
s first
letter of
string?

Which of
the
following
function
checks in shuffle(ls capitalize
isdigit() isdigit()
a string t) () isalnum()
that all
character
s are
digits?
Which of
the
following
function
convert
unichr(x) ord(x) hex() oct(x) oct(x)
an
integer to
octal
string in
python?

Which are Reducing Decompo Improvin All of the All of the


the duplicatio sing g clarity mentione mentione
advantages n of code complex of the d d
of problems code
functions into
in python? simpler
pieces

What are Custom Built-in User System Built-in


the two function function function function function
main types & User & User
of defined defined
functions? function function

Where is Module Class Another All of the All of the


function function mentione mentione
defined? d d
What is [‘h’, ‘e’, [‘hello’] [‘llo’] [‘olleh’] [‘h’, ‘e’,
the output ‘l’, ‘l’, ‘l’, ‘l’,
when we ‘o’] ‘o’]
execute
list(“hello
”)?

Suppose 5 4 3 6 5
listExamp
le is
[‘h’,’e’,’l’
,’l’,’o’],
what is
len(listEx
ample)?
Suppose [2, 33, Error 25 [25, 14, [2, 33,
list1 is [2, 222, 14] 222, 33, 222, 14]
33, 222, 2]
14, 25],
What is
list1[:-
1] ?

Which of [1, 2, 3] (1, 2, 3) {1, 2, 3} {} (1, 2, 3)


the
following
is a
Python
tuple?

The if...eli 1 0 It depends There is


f...else exe on no elif
cutes only expressio statement
one block n used in python
of code
among
several
blocks.

In only for only Both for Loops


Python, fo loop can while and while cannot
r and whil have loop can can have have
e loop can optional have optional optional
have else optional else else
optional statement else statement statement
else s statement s in python
statement? s

Suppose [0, 1, 2, [0, 1, 2, [0.0, 0.5, [0.0, 0.5, [0.0, 0.5,


list1 = 3] 3, 4] 1.0, 1.5] 1.0, 1.5, 1.0, 1.5]
[0.5 * x 2.0]
for x in
range(0,
4)], list1
is :
Which of list1 = list1 = [] list1 = all of the all of the
the list() list([1, 2, mentione mentione
following 3]) d d
command
s will
create a
list?

Suppose [3, 4, 5, [1, 3, 3, [3, 5, 20, [1, 3, 4, [3, 5, 20,


list1 is [3, 20, 5, 25, 4, 5, 5, 5, 25, 1, 5, 20, 5, 5, 25, 1,
4, 5, 20, 1, 3] 20, 25] 3] 25] 3]
5, 25, 1,
3], what
is list1
after
list1.pop(
1)?

Let a = print(a[:] print(a[0: print(a[:1 print(a[- print(a[:1


[ 1,2,3,4,5 ) => ]) => 00]) => 1:]) => 00]) =>
] then [1,2,3,4] [2,3,4,5] [1,2,3,4,5 [1,2] [1,2,3,4,5
which of ] ]
the
following
is
correct ?

What data List Dictionar Tuple Array List


type is y
the object
below ? L
= [1, 23,
‘hello’, 1]

You might also like