Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CODEATHON'22

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

1)What will be the output of the following code :

print type(type(int))

Run on IDE

a)

type 'int'

b)

type 'type'

c)

Error

d)

0

2.

2)What is the output of the following code :

L = ['a','b','c','d']

print("".join(L))

a)

Error

b)

None

c)

abcd

d)

['a','b','c','d']

3.

3)What is the output of the following segment :

chr(ord('A'))

a)

A

b)

ef

c)

a

d)

Error

4.

4)Which of the following is the use of id() function in python?

a)

Id returns the identity of the object

b)

Every object doesn’t have a unique id

c)

All of the mentioned

d)

None of the mentioned

5.

5) time. time() returns ____

a)

the current time

b)

the current time in milliseconds

c)

the current time in milliseconds since midnight

d)

the current time in milliseconds since midnight, January 1, 1970 GMT (the Unix time)

6.

6)Which of the followings is correct for a function definition along with storage-class specifier in C language?

a)

int fun(auto int arg)

b)

int fun(static int arg)

c)

int fun(register int arg)

d)

int fun(extern int arg)

e)

All of the above are correct

7.

7)Pick the correct statement for const and volatile.

a)

const is the opposite of volatile and vice versa

b)

const and volatile can’t be used for struct and union

c)

const and volatile can’t be used for enum

d)

const and volatile can’t be used for typedef

e)

const and volatile are independent i.e. it’s possible that a variable is defined as both const and volatile.

8.

8)In the context of C data types, which of the followings is correct?

a)

“unsigned long long int” is a valid data type.

b)

“long long double” is a valid data type.

c)

“unsigned long double” is a valid data type.

9.

9)Suppose a C program has floating constant 1.414, what’s the best way to convert this as “float” data type?

a)

(float)1.414

b)

float(1.414)

c)

1.414f or 1.414F

d)

1.414 itself of “float” data type i.e. nothing else required

10.

10) typedef” in C basically works as an alias. Which of the following is correct for “typedef”?

a)

typedef can be used to alias compound data types such as struct and union

b)

typedef can be used to alias both compound data types and pointer to these compound types

c)

typedef can be used to alias a function pointer

d)

typedef can be used to alias an array

e)

All of the above

11.

11) Which of the following is FALSE about arrays on Java?

a)

A java array is always an object

b)

Length of array can be changed after creation of array

c)

Arrays in Java are always allocated on heap

12.

12) In Java, can we make functions inline like C++?

a)

yes

b)

no

13.

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);

}

}

a)

20

b)

0

c)

Compiler Error

14.

14) Which of the following is not an operator in Java?

a)

instance of

b)

size of

c)

new

d)

>>>=

15.

15) Find the output of the following Java code line:

System.out.println(math.floor(-7.4))

a)

-7

b)

-8

c)

-7.4

d)

-7.0

16.

16) Which of the following is not a stable sorting algorithm in its typical implementation

a)

Insertion Sort

b)

Merge Sort

c)

Quick Sort

d)

Bubble Sort

17.

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.

a)

1

b)

2

c)

3

d)

4

18.

18) Which of the following standard algorithms is not Dynamic Programming based?

a)

Bellman–Ford Algorithm for single source shortest path

b)

Floyd Warshall Algorithm for all pairs shortest paths

c)

0-1 Knapsack problem

d)

Prim’s Minimum Spanning Tree

19.

19) Kadane algorithm is used to find

a)

Maximum sum subsequence in an array

b)

Maximum sum subarray in an array

c)

Maximum product subsequence in an array

d)

Maximum product subarray in an array

20.

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?

a)

HTTP, SMTP, FTP

b)

FTP, HTTP, SMTP

c)

HTTP, FTP, SMTP

d)

SMTP, HTTP, FTP