NEW
Font size
WorksheetsAdvanced programing w\ Python (Ep1)
Total questions: 61
Worksheet time: 31mins
Who developed Python Programming Language?
Wick van Rossum
Rasmus Lerdorf
Guido van Rossum
Niene Stom
Which type of Programming does Python support?
object-oriented programming
structured programming
functional programming
all of the mentioned
Is Python case sensitive when dealing with identifiers?
no
yes
machine dependent
none of the mentioned
Which of the following is the correct extension of the Python file?
.python
.pl
.py
.p
Is Python code compiled or interpreted?
Python code is both compiled and interpreted
Python code is neither compiled nor interpreted
Python code is only compiled
Python code is only interpreted
All keywords in Python are in _________
Capitalized
lower case
UPPER CASE
None of the mentioned
What will be the value of the following Python expression?
4 + 3 % 5
7
2
4
1
Which of the following is used to define a block of code in Python language?
Indentation
Key
Brackets
All of the mentioned
Which keyword is used for function in Python language?
Function
def
Fun
define
Which of the following character is used to give single-line comments in Python?
//
#
!
/*
What will be the output of the following Python code?
1 2 3
error
1 2
none of the mentioned
Which of the following functions can help us to find the version of python that we are currently working on?
sys.version(1)
sys.version(0)
sys.version()
sys.version
Python supports the creation of anonymous functions at runtime, using a construct called __________
pi
annoymous
lambda
none of the mentioned
What is the order of precedence in python?
Exponential, Parentheses, Multiplication, Division, Addition, Subtraction
Exponential, Parentheses, Division, Multiplication, Addition, Subtraction
Parentheses, Exponential, Multiplication, Division, Subtraction, Addition
Parentheses, Exponential, Multiplication, Division, Addition, Subtraction
What will be the output of the following Python code snippet if x=1?
x<<2
4
2
1
8
What does pip stand for python?
Pip Installs Python
Pip Installs Packages
Preferred Installer Program
All of the mentioned
Which of the following is true for variable names in Python?
underscore and ampersand are the only two special characters allowed
unlimited length
all private members must have leading and trailing underscores
none of the mentioned
What are the values of the following Python expressions?
2**(3**2)
(2**3)**2
2**3**2
512, 64, 512
512, 512, 512
64, 512, 64
64, 64. 64
Which of the following is the truncation division operator in Python?
|
//
/
%
What will be the output of the following Python code?
[1, 0, 2, ‘hello’, ”, []]
error
[1, 2, ‘hello’]
[1, 0, 2, 0, ‘hello’, ”, []]
Which of the following functions is a built-in function in python?
factorial()
print()
seed()
sqrt()
Which of the following is the use of id() function in python?
Every object doesn’t have a unique id
Id returns the identity of the object
All of the mentioned
None of the mentioned
The following python program can work with ____ parameters.
any number of
0
1
2
What will be the output of the following Python function?
min(max(False,-3,-4), 2,7)
-4
-3
-2
False
Which of the following is not a core data type in Python programming?
Tuples
Lists
Class
Dictionary
What will be the output of the following Python expression if x=56.236?
print("%.2f"%x)
56,236
56,23
56,000
56,24
Which of these is the definition for packages in Python?
A set of main modules
A folder of python modules
A number of files containing Python definitions and statements
A set of programs making use of Python modules
What will be the output of the following Python function?
len(["hello",2, 4, 6])
error
6
4
3
What will be the output of the following Python code?
x = 'abcd'
for i in x:
print(i.upper())
aBCD
abcd
error
ABCD
What is the order of namespaces in which Python looks for an identifier?
Python first searches the built-in namespace, then the global namespace and finally the local namespace
Python first searches the built-in namespace, then the local namespace and finally the global namespace
Python first searches the local namespace, then the global namespace and finally the built-in namespace
Python first searches the global namespace, then the local namespace and finally the built-in namespace
What will be the output of the following Python code snippet?
for i in [1, 2, 3, 4][::-1]:
print (i)
4 3 2 1
error
1 2 3 4
none of the mentioned
What will be the output of the following Python statement?
1. >>>"a"+"bc"
bc
abc
a
bca
Which function is called when the following Python program is executed?
f = foo()
format(f)
str()
format()
____str___()
____format___()
Which one of the following is not a keyword in Python language?
pass
eval
assert
nonlocal
What will be the output of the following Python code?
12
224
none
error
What will be the output of the following Python program?
error
none
false
true
Which module in the python standard library parses options received from the command line?
getarg
getopt
main
os
What will be the output of the following Python program?
{‘a’, ‘c’, ‘c’, ‘p’, ‘q’, ‘s’, ‘a’, ‘n’}
{‘a’, ‘b’, ‘c’, ‘p’, ‘q’, ‘san’}
{‘a’, ‘b’, ‘c’, [‘p’, ‘q’], ‘san}
{‘abc’, ‘p’, ‘q’, ‘san’}
What arithmetic operators cannot be used with strings in Python?
*
-
+
all of the mentioned
What will be the output of the following Python code?
print("abc. DEF".capitalize())
Abc. def
abc. def
Abc. Def
ABC. DEF
Which of the following statements is used to create an empty set in Python?
( )
[ ]
{ }
set()
What will be the value of ‘result’ in following Python program?
[1, 3, 5, 7, 8]
[1, 7, 8]
[1, 3, 4, 7, 8]
error
To add a new element to a list we use which Python command?
list1.addEnd(5)
list1.addLast(5)
list1.append(5)
list1.add(5)
What will be the output of the following Python code?
print('*', "abcde".center(6), '*', sep='')
* abcde *
* abcde *
* abcde *
* abcde *
What will be the output of the following Python code?
[1, 4]
[1, 3, 4]
[4, 3]
[1, 3]
Which one of the following is the use of function in python?
Functions don’t provide better modularity for your application
you can’t also create your own functions
Functions are reusable pieces of programs
all of the mentioned
Which of the following Python statements will result in the output: 6?
A = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]]
A[2][1]
A[1][2]
A[3][2]
A[2][3]
What is the maximum possible length of an identifier in Python?
79 characters
31 characters
63 characters
none of the mentioned
What will be the output of the following Python program?
error
0 1 2 0
0 1 2
none of the mentioned
What will be the output of the following Python code?
x = 'abcd'
for i in range(len(x)):
print(i)
error
1 2 3 4
a b c d
0 1 2 3
What are the two main types of functions in Python?
System function
Custom function
User function
Built-in function & User defined function
What will be the output of the following Python program?
5
8
2
1
Which of the following is a Python tuple?
{1, 2, 3}
{}
[1, 2, 3]
(1, 2, 3)
What will be the output of the following Python code snippet?
z=set('abc$de')
'a' in z
error
true
false
none
What will be the output of the following Python expression?
round(4.576)
4
4.6
5
4.5
Which of the following is a feature of Python DocString?
In Python all functions should have a docstring
Docstrings can be accessed by the doc attribute on objects
It provides a convenient way of associating documentation with Python modules, functions, classes, and methods
All of the mentioned
What will be the output of the following Python code?
print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
Hello (‘foo’, ‘bin’) and (‘foo’, ‘bin’)
error
Hello foo and bin
none
What is output of print(math.pow(3, 2))?
9.0
none
9
all
Which of the following is the use of id() function in python?
Every object in Python doesn’t have a unique id
In Python Id function returns the identity of the object
none
all
What will be the output of the following Python code?
x = [[0], [1]]
print((' '.join(list(map(str, x))),))
01
[0] [1]
('01')
('[0] [1]',)
What will be the output of the following Python code?
error, there is more than one return statement in a single try-finally block
3
2
1
