What will be the output of the following Python code?
example = "helle" print(example.rfind("e"))
-1
4
3
1
(x**y)**z
(x**y) / z
(x**y) % z
(x**y)*z
nested if
if..else
else if
if..elif
Testing
Syntax error
Runtime error
Debugging
id(x) == id(y)
len(x) == len(y)
x == y
all of these
0
10
1.0
5
print(t[3])
t[3] = 45
print(max(t))
print(len(t))
f = open("data.txt", "a")
f = Open("data.txt", "ab")
f= new("data.txt", "a")
open("data.txt", "a")
True
False
Error
infinite
ZeroDivisionError
8
16
32
What will the following code output?
a,b,c=3,5,6 b,c,a=a,b,c print(a,” ”,b,” ”,c)
3 5 6
6 3 5
5 6 3
6 5 3
a,b,c=3,5,6 b,c,a=a+1,b+2,c+3 print(a,” ”,b,” ”,c)
7 9 4
4 7 9
9 4 7
a=5 a*=10 print(a)
50
a=‘INFOMAX’ a=10 print(type(a))
<class 'int'>
<class ‘str'>
<class ‘bool'>
a=555 b=55 print( b in a)
55
TypeError
a=55 b=’55’ print( a is not b)
a=55 b=55 print( a is not b)
6
1.5
Removes all spaces from the string.
Removes the first and last character of the string.
Removes whitespace from the beginning and end of the string.
Converts the string into a list of characters.
startswith()
startswith_prefix()
startswithwith()
startswiths()
19
18
17
Strings can be modified using indexing.
Strings are immutable.
Strings can only contain alphabetic characters.
Strings must end with a newline character.
capitalize()
pop()
find()
insert()
append()
extend()
add()
It returns None.
It raises an IndexError
It creates a new element at that index.
It returns an empty list.
t1=1,2,4
t1=(1,)
t1=tuple(“123”)
All of these
(1)
(1,)
[1]
{1}
('abc’)
('a', 'b', 'c’)
['a', 'b', 'c’]
Slicing
Concatenation
Deletion of elements
Iteration
keys()
getkeys()
allkeys()
keyvalues()
A collection of ordered and mutable data
A collection of unordered and mutable data with key-value pairs
A collection of immutable key-value pairs
A collection of values only
Returns None
Throws a KeyError
Creates a new key with a default value
Crashes the program
Clears all key-value pairs
Updates a specific key
Merges another dictionary into the current one
Removes all values
copy = list(original)
copy = original[:]
copy = original.copy()
All of the above
What is the output when we execute
list("hello") ?
['h', 'e', 'l', 'l', 'o']
[' hello']
['llo']
['olleh']
list
set
tuple
dictionary
x=0 if x: print("True") else: print("False")
None
What is the output of the following code?
for i in range(3): print(i,end=" ")
0 1 2
1 2 3
0 1 2 3
count=0 while count<3: print(count,end=" ") count+=1
Match the following types of programming paradigms with their descriptions.
A-1, B-2, C-3, D-4
A-3, B-4, C-1, D-2
A-2, B-1, C-4, D-3
A-4, B-3, C-2, D-1