WorksheetsRound 3: Coding Round
Total questions: 24
Worksheet time: 30mins
1)What is the output of the functions shown below?
float('1e-003')
float('2e+003')
a) 3.00 and 300
b) 0.001 and 2000.0
c) 0.001 and 200
d) Error and 2003
Which of the following is not a valid way to handle exceptions in Python?
A) try -except block
B) finally block
c) catch block
d) else block
3)Which header file uses-> gets()
Studio. h
Stdlib.h
Conio.h
All of the above
4)Which of the following is an important requirement of c programming?
Function
Input variables
Output variables
All of the above
5)In the following options which are python libraries which are used for data analysis and scientific computations
Numpy
Scipy
Pandas
All of the above
6)In the following options which are python libraries which are used for data analysis and scientific computations
Intrepreted language
portable
High level Language
More than one of the above
None of the above
)Which data structure is efficient to search the string in the dictionary that is containing a large number of strings?
A) Graph
B) Trie
C) Array
D) HashMap
8)Ramesh is working on array and he wants to pass the array to a function. If he is passing the array as an argument to a function, what actually he is passing?
A)The starting index of the array
B) The memory address of the first element of the array
C) The size of the array
D) A pointer to the first element of the array
9)Which bitwise operator is suitable for turning off a particular bit in a number?
&&
|
&
<<
10)Which of the following is not a valid way to handle exceptions in Python?
try -except block
finally block
catch block
else block
11)List is ……. Data structure
mutable
immutable
both mutable & immutable
None
12)give correct order naming for further symbols used in python
Symbols
/ // %
slash ,
double slash ,
percent
div,
floor divi,
modulus
floor divi,
div,
modulus
none
13)What is the output of the following a=[1,2,3,2,5]
b=2, c=[]
for i in a: c.append(i^b)A) [3,0,5,7,0]
B) [3,0,1,6,1]
C) [3,0,1,0,5]
D) [3,0,1,0,7]
14) What is the output of the following
def my_func(n):
if n == 0:
return 0
elif n == 1:
return 1
else:
return my_func(n-1) + my_func(n-2)
print(my_func(6))
A) 8
B) 12
C) 6
D) 15
15) What will be the result of the num1 variable after execution of the following statements?
int j = 1, num1 = 4;
while (++j <= 10)
{
num1++;
}
A) 13
B) 12
C)14
D)17
16) What is the output of the following
#include <stdio.h>
int main()
{
int i = 3;
printf("%d", (++i)++);
return 0;
}
A) 7
B) 9
C) 11
D) Error
17) What is the output of the following
def outer_function(x):
def inner_function(y):
return x * y
return inner_function
double = outer_function(2)
triple = outer_function(3)
print(double(4))
print(triple(4))
A) 8 , 12
B) 2, 3
C) 16 ,24
D) 4,6
18) What is the output of the following
#include <stdio.h>
int main() {
int arr[] = {1, 2, 3, 4, 5};
int *p = arr + 2;
printf("%d\n", p[1]);
return 0;
}
A) 1
B) 2
C) 3
D) 4
19)What will be the output of program?
main()
{
int n=(5,10,15);
cout<<n;
}
5
10
15
error
20) output ?
i=0
j=20
while i < j:
i = i+5
j = j - 5
print( i , j )
5 15
10 10
15 15
10 10
10 15
10 15
none
21) Output?
i=0
t=1
while i<=10:
if i%2==0:
t=t+1
i=i+1
print(t)
5
6
7
8
22) Output?
t=0
for i in range(10):
if i%2==0:
t=t+i
else:
t=t+1
print(t)
18
19
24
25
23) Output?
n=1996
if n%400==0:
print("Leap Year")
elif n%100==0:
print("Not Leap Year")
elif n%4==0:
print("Leap Year")
else:
print("Not Leap Year")
Not Leap Year
Leap Year
leap year
not leap year
24) What is the output of the following
If n is the size of input(positive), which function is most efficient(if the task to be performed is not an issue)?
A) for(i = 0; i < n; i++)
B) for(i = 0; i < n; i += 2)
C) for(i = 1; i < n; i *= 2)
D) for(i = n; i <= n; i /= 2)
E)None
