WorksheetsCODEATHON'22
Total questions: 20
Worksheet time: 7mins
1)What will be the output of the following code :
print type(type(int))
Run on IDE
type 'int'
type 'type'
Error
0
2)What is the output of the following code :
L = ['a','b','c','d']
print("".join(L))
Error
None
abcd
['a','b','c','d']
3)What is the output of the following segment :
chr(ord('A'))
A
ef
a
Error
4)Which of the following is the use of id() function in python?
Id returns the identity of the object
Every object doesn’t have a unique id
All of the mentioned
None of the mentioned
5) time. time() returns ____
the current time
the current time in milliseconds
the current time in milliseconds since midnight
the current time in milliseconds since midnight, January 1, 1970 GMT (the Unix time)
6)Which of the followings is correct for a function definition along with storage-class specifier in C language?
int fun(auto int arg)
int fun(static int arg)
int fun(register int arg)
int fun(extern int arg)
All of the above are correct
7)Pick the correct statement for const and volatile.
const is the opposite of volatile and vice versa
const and volatile can’t be used for struct and union
const and volatile can’t be used for enum
const and volatile can’t be used for typedef
const and volatile are independent i.e. it’s possible that a variable is defined as both const and volatile.
8)In the context of C data types, which of the followings is correct?
“unsigned long long int” is a valid data type.
“long long double” is a valid data type.
“unsigned long double” is a valid data type.
9)Suppose a C program has floating constant 1.414, what’s the best way to convert this as “float” data type?
(float)1.414
float(1.414)
1.414f or 1.414F
1.414 itself of “float” data type i.e. nothing else required
10) typedef” in C basically works as an alias. Which of the following is correct for “typedef”?
typedef can be used to alias compound data types such as struct and union
typedef can be used to alias both compound data types and pointer to these compound types
typedef can be used to alias a function pointer
typedef can be used to alias an array
All of the above
11) Which of the following is FALSE about arrays on Java?
A java array is always an object
Length of array can be changed after creation of array
Arrays in Java are always allocated on heap
12) In Java, can we make functions inline like C++?
yes
no
13) Predict the output:
package main;
class T {
int t = 20;
}
class Main {
public static void main(String args[]) {
T t1 = new T();
System.out.println(t1.t);
}
}
20
0
Compiler Error
14) Which of the following is not an operator in Java?
instance of
size of
new
>>>=
15) Find the output of the following Java code line:
System.out.println(math.floor(-7.4))
-7
-8
-7.4
-7.0
16) Which of the following is not a stable sorting algorithm in its typical implementation
Insertion Sort
Merge Sort
Quick Sort
Bubble Sort
17) How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.
1
2
3
4
18) Which of the following standard algorithms is not Dynamic Programming based?
Bellman–Ford Algorithm for single source shortest path
Floyd Warshall Algorithm for all pairs shortest paths
0-1 Knapsack problem
Prim’s Minimum Spanning Tree
19) Kadane algorithm is used to find
Maximum sum subsequence in an array
Maximum sum subarray in an array
Maximum product subsequence in an array
Maximum product subarray in an array
20) Consider the three commands : PROMPT, HEAD and RCPT.
Which of the following options indicate a correct association of these commands with protocols where these are used?
HTTP, SMTP, FTP
FTP, HTTP, SMTP
HTTP, FTP, SMTP
SMTP, HTTP, FTP
