Documente Academic
Documente Profesional
Documente Cultură
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Question
What is output for : a=['he','she','we']' '.join(a)
What is the output of following code : [ (a,b) for a in range(3) for b in range(a) ]
In the following options which are python libraries which are used for data analysis and scientific computations
What is output for : 2 * 2 **3
What command is used to insert 6 in a list ‘‘L’’ at 3rd position ?
Which of the following is more accurate for the following declaration? x = Circle()
Which method is used to display a warning message in Python?
In Python we can create a popup menu. Select the code to display a popup menu?
What will be the output of the following Python code? print("Hello {name1} and {name2}".format(name1='foo', nam
What will be the output of the following Python code? print("Hello {0!r} and {0!s}".format('foo', 'bin'))
What will be the output of the following Python code? print("Hello {0} and {1}".format(('foo', 'bin')))
What will be the output of the following Python code? print("Hello {0[0]} and {0[1]}".format(('foo', 'bin')))
What will be the output of the following Python code snippet? print('The sum of {0} and {1} is {2}'.format(2, 10, 12))
What will be the output of the following Python code snippet? print('The sum of {0:b} and {1:x} is {2:o}'.format(2, 1
What will be the output of the following Python code snippet? print('{:,}'.format(1112223334))
What will be the output of the following Python code snippet? print('{:$}'.format(1112223334))
What will be the output of the following Python code snippet? print('{:#}'.format(1112223334))
What will be the output of the following Python code? print('{0:.2}'.format(1/3))
What will be the output of the following Python code? print('{0:.2%}'.format(1/3))
What will be the output of the following Python code? print('ab12'.isalnum())
What will be the output of the following code: print type(type(int))
1.A hash function takes a message of arbitrary length and generates a fixed length code.
2.A hash function takes a message of fixed length and generates a code of variable length.
3.A hash function may give the same hash value for distinct messages.
print myfunc(2)
What is the output of the expression : 3*1**3
What is the output of the following program :
print '{0:.2}'.format(1.0 / 3)
What is the output of the following program :
print '{0:-2%}'.format(1.0 / 3)
depicts a null string and the join function combines the elements of the list into a string.
ord() function converts a character into its ASCII notation and chr() converts the ASCII to character.
Each object in Python has a unique id. The id() function returns the object’s id.
The ‘//’ operator in Python returns the integer part of the floating number.
rshift() overloads the >> operator
or() function overloads the bitwise OR operator
[::] depicts extended slicing in Python and [::-1] returns the reverse of the string.
Python explicitly defines the None object that is returned if no value is specified.
re is a part of the standard library and can be imported using: import re.
Neither of 0.1, 0.2 and 0.3 can be represented accurately in binary. The round off errors from 0.1 and 0.2 accumulate and henc
l (or L) stands for long.
~x is equivalent to -(x+1).
strings are immutable in Python
[ ] defines a list
float(x) − Converts x to a floating-point number
Hash function is defined as any function that can be used to map data of arbitrary size of data to a fixed size data.. The values r
Statement 1 is correct
Yes, it is possible that a Hash Function maps a value to a same location in the memmory that’s why collision occurs and we hav
eg : we have hash function, h(x) = x mod 3
Python creates blocks of code based on the indentation of the code. Thus, new indent defines a new scope.
Precedence of ** is higher than that of 3, thus first 1**3 will be executed and the result will be multiplied by 3.
The else part is executed when the condition in the while statement is false.
The else part is not executed if control breaks out of the loop.
The entire string has been passed as the separator hence the first and the last item of the tuple returned are null strings.
The separator is not present in the string hence the second and the third elements of the tuple are null strings.
The first substring is not present in the given string and hence nothing is replaced.
The value of t=3 is passed in funcion f(value,values) , v [list] is passed as values in the same function. The v is stored in values a
A
D
A
C
E
B
C
D
B
A
D
A
B
C
A
C
A
C
C
D
A
C
C
D
A
Choice1
['heshewe']
[ (1,0),(2,1),(3,2)]
Numpy
12
L.insert(2,6)
Now you can assign int value to x.
Tkinter.message.showmessage('message here')
Menu.post(250,250)
Hello foo and bin
Hello foo and foo
Hello foo and bin
Hello foo and bin
The sum of 2 and 10 is 12
The sum of 2 and 10 is 12
1,112,223,334
1,112,223,334
1,112,223,334
0
0
1
type ‘int’
Error
48
Module
4.5
more()
||
021324
dlroW olleH
int
re
1
k = 2 + 3j
5
print s[0]
Stub
execute python
It supports automatic garbage collection.
Lists
List
int(x [,base])
I only
8
27
0.333333
0.33
01230
0120
(‘cd’)
(‘abef’)
ab1ef2
11
None
14
Class
4.3
gt()
|
012345
Hello Worl
bool
regex
0
k = complex(2, 3)
-11
print s.lower()
Function
go python
It can be easily integrated with C, C++, COM, ActiveX, CORBA, and Java
Dictionary
Dictionary
long(x [,base] )
16
9
0.33
0.33%
0120
012
(”)
(‘abef’, ‘cd’, ”)
abcefd
1 44
abcd
no
Choice 3
['he she we']
[(1,0),(2,1),(2,1)]
Pandas
16
L.add(3,6)
x actually contains an object of type Circle.
Tkinter.messagebox.showwarning('message here')
Menu.display()
Error
Hello foo and ‘bin’
Error
Error
The sum of 0 and 1 is 2
The sum of 10 and a is c
1112223334
1112223334
1112223334
0.333333:.2
33.33%
None
Error
abcd
64
Another Function
4
ge()
//
Error
d
void
pyregex
Machine dependent
k = 2 + 3l
11
s[1] = ‘r’
A function developed using bottom-up approach
python
Both of the above
Tuples
Tuple
float(x)
Indentation Error
3
0.333333:-2
33.33%
012
Error
(‘cd’, ”, ”)
(‘abef’, ”, ”)
ab1efd
31
(786, 2.23)
machine dependent
Choice 4
'he she we'
[ (1,0),(2,0),(2,1)]
All the above
36
L.append(2,6)
x contains an int value.
Tkinter.messagebox.showmessage('message here')
Menu.display_popup(250,250)
Hello and
Error
None of the mentioned
None of the mentioned
None of the mentioned
Error
Error
Error
Error
Error
33%
Error
0
[‘a’,’b’,’c’,’d’]
Error
‘are’
Error
None of the mentioned
/
102435
Error
None
None of the mentioned
Error
k = 2 + 3J
-5
print s.strip()
A function developed using top-down approach
run python
None of the above
Class
Array
str(x)
II only
Runtime error
1
error
33%
Error
(”, ‘cd’, ”)
Error
ab12ed2
3 44
the current time in milliseconds since midnight, January 1, 1970 GMT (the Unix time)