#answer to the question 👆is ————-»»» class float
Since the result of 1/2 is 0.5, which is a float.
65% got it correct.
Since the result of 1/2 is 0.5, which is a float.
65% got it correct.
#answer to the question 👆is ————-»»» b) hello world!
the keyword argument sep by default is set to a single space " ", hence it add's a space inbetween the two words.
50% have answered it correct.
the keyword argument sep by default is set to a single space " ", hence it add's a space inbetween the two words.
50% have answered it correct.
x = "Hello World!"
Which of the following is incorrect & Why?
Which of the following is incorrect & Why?
Anonymous Quiz
18%
print(x[0])
49%
x[0] = ‘h’
22%
print(x.strip())
11%
print(x.upper())
________ is a simple but incomplete version of a function
Anonymous Quiz
51%
Stub
17%
Function
20%
A function developed using bottom-up approach
11%
A function developed using top-down approach
Given a function that does not return any value, what value is shown when executed at the shell?
Anonymous Quiz
8%
Int
6%
Float
11%
bool
36%
void
39%
None
What is the optput of the expression
1 + 2 ** 3 * 4
Explain why?
1 + 2 ** 3 * 4
Explain why?
Anonymous Quiz
51%
33
12%
36
14%
108
15%
4097
7%
531441
Which function is to be used to print to console?
Anonymous Quiz
15%
printf()
28%
console.out()
50%
print()
4%
log()
2%
write()
What is output of the following code?
a = ['he', 'she', 'we']
' '.join(a)
a = ['he', 'she', 'we']
' '.join(a)
Anonymous Quiz
43%
'heshewe'
15%
'he,she,we'
26%
'he she we'
16%
error
Which of the following is correct about Python?
Anonymous Quiz
12%
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java
18%
It supports automatic garbage collection.
62%
All above
9%
None of the above
What is output of following code?
x = (5, 7)
x[0] +=3
x = (5, 7)
x[0] +=3
Anonymous Quiz
4%
7
37%
(8,7)
26%
Type Error
23%
Syntax Error
10%
(5,7), nothing changes
In Python, functions can also have attributes and methods.
Anonymous Quiz
11%
Only Attributes
7%
Only Methods
79%
Both Attribures & Methods
3%
None
How can we check whether the object is instance of class or not.
For example, how to check if an object O which is instance of class C.
For example, how to check if an object O which is instance of class C.
Anonymous Quiz
29%
C.isinstance(O)
40%
O.isinstance(C)
25%
isinstance(O,C)
7%
isinstance(C,O)
Python Questions
What is output of following code?
x = (5, 7)
x[0] +=3
x = (5, 7)
x[0] +=3
✅ Answer ✅
TypeError − ‘tuple’ object does not support item assignment because a tuple is immutable.
TypeError − ‘tuple’ object does not support item assignment because a tuple is immutable.
def foo(x = 10, y = 15):
return(x + y, x - y)
x, y = foo(y = 20, x = 15) print(x, y) #What is the output of the following code?
return(x + y, x - y)
x, y = foo(y = 20, x = 15) print(x, y) #What is the output of the following code?
Anonymous Quiz
33%
Error - arguments order
49%
35 -5
13%
35 30
5%
30 30
Which is the correct way to create an empty set in Python?
Anonymous Quiz
20%
[..]
25%
set[..]
14%
(..)
40%
set(..)
Consider the following sequence of statements:
n = 300
m = n Following execution of these statements, Python has created how many objects and how many references?
n = 300
m = n Following execution of these statements, Python has created how many objects and how many references?
Anonymous Quiz
19%
Two objects, two references
35%
One object, two references
29%
Two objects, one reference
17%
One object, one reference
What Python built-in function returns the unique number assigned to an object:
Anonymous Quiz
13%
refnum()
24%
identity()
50%
id()
13%
ref()
Which of the following styles does PEP8 recommend for multi-word variable names
Anonymous Quiz
29%
DistanceToNearestTown (Pascal Case)
36%
distanceToNearestTown (Camel Case)
35%
distance_to_nearest_town (Snake Case)
Which of the following are Python reserved words (keywords). Select all that is correct.
Anonymous Poll
50%
default
57%
None
68%
class
58%
and
32%
goto