Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

EC8393

Total questions: 45

Worksheet time: 31mins

Name
Class
Date
1.

Which of the following is a User-defined data type?

a)

typedef int Boolean;

b)

typedef enum {Mon, Tue, Wed, Thu, Fri} Workdays;

c)

struct {char name[10], int age};

d)

all of the mentioned

2.

The format identifier ‘%i’ is also used for _____ data type.

a)

char

b)

int

c)

float

d)

double

3.

Which of following is not accepted in C?

a)

static a = 10; //static as

b)

static int func (int); //parameter as static

c)

static static int a; //a static variable prefixed with static

d)

all of the mentioned

4.

When double is converted to float, then the value is?

a)

Truncated

b)

Rounded

c)

Depends on the compiler

d)

Depends on the standard

5.

Which among the following has the highest precedence?

a)

&

b)

<<

c)

sizeof()

d)

&&

6.

What is a preprocessor?

a)

That processes its input data to produce output that is used as input to another program

b)

That is nothing but a loader

c)

That links various source files

d)

All of the mentioned

7.

Which of the following is an invalid assignment operator?

a)

a %= 10;

b)

a /= 10;

c)

a |= 10;

d)

None of the mentioned

8.

Comment on the following pointer declaration.

int *ptr, p;

a)

ptr is a pointer to integer, p is not

b)

ptr and p, both are pointers to integer

c)

ptr is a pointer to integer, p may or may not be

d)

ptr and p both are not pointers to integer

9.

What is (void*)0?

a)

Representation of NULL pointer

b)

Representation of void pointer

c)

Error

d)

None of above

10.

A pointer is

a)

A keyword used to create variables

b)

A variable that stores address of an instruction

c)

A variable that stores address of other variable

d)

All of the above

11.

Choose correct statements about C Language Pass By Value.

a)

Pass By Value copies the variable value in one more memory location.

b)

Pass By Value does not use Pointers.

c)

Pass By Value protects your source or original variables from changes in outside functions or called functions.

d)

All the above

12.

A function which calls itself is called a ___ function.

a)

Self Function

b)

Auto Function

c)

Recursive Function

d)

Static Function

13.

A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a ?

a)

Queue

b)

Stack

c)

Tree

d)

Linked list

14.

Circular Queue is also known as ________

a)

Ring Buffer

b)

Square Buffer

c)

Rectangle Buffer

d)

Curve Buffer

15.

A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?

a)

Queue

b)

Circular queue

c)

Dequeue

d)

Priority queue

16.

Queues serve major role in ______________

a)

Simulation of recursion

b)

Simulation of arbitrary linked list

c)

Simulation of limited resource allocation

d)

Simulation of heap sort

17.

A queue follows

a)

FIFO (First In First Out) principle

b)

LIFO (Last In First Out) principle

c)

Ordered array

d)

Linear tree

18.

The time complexity of converting a prefix notation to infix notation is _________

a)

O(n) where n is the length of the equation

b)

O(n) where n is number of operands

c)

O(1)

d)

O(logn) where n is length of the equation

19.

To obtain a prefix expression, which of the tree traversals is used?

a)

Level-order traversal

b)

Pre-order traversal

c)

Post-order traversal

d)

In-order traversal

20.

The number of elements in the adjacency matrix of a graph having 7 vertices is __________

a)

7

b)

14

c)

36

d)

49

21.

An expression tree is a kind of?

a)

Binary search tree

b)

Fibonacci tree

c)

Binary tree

d)

Treap

22.

Which of the following is the name of the node having child nodes?

a)

Brother

b)

Sister

c)

Mother

d)

Parent

23.

What is the maximum number of children that a binary treenode can have?

a)

0

b)

1

c)

2

d)

3

24.

Which of these operators have the highest order of precedence?

a)

‘(‘ and ‘)’

b)

‘*’ and ‘/’

c)

‘~’ and ‘^’

d)

‘+’ and ‘-‘

25.

Where is linear searching used?

a)

When the list has only a few elements

b)

When performing a single search in anunordered list

c)

Used all the time

d)

When the list has only a few elements andWhen performing a single search in anunordered list

26.

What is an external sorting algorithm?

a)

Algorithm that uses tape or disk during thesort

b)

Algorithm that uses main memory duringthe sort

c)

Algorithm that involves swapping

d)

Algorithm that are considered ‘in place’

27.

Which of the following sorting algorithms is the fastest?

a)

Merge sort

b)

Quick sort

c)

Insertion sort

d)

Shell sort

28.

What is a hash table?

a)

A structure that maps values to keys

b)

A structure that maps keys to values

c)

A structure used for storage

d)

A structure used to implement stack and queue

29.

What is a hash function?

a)

A function has allocated memory to keys

b)

A function that computes the location of the key in the array

c)

A function that creates an array

d)

A function that computes the location of the values in the array

30.

Which of the following is not an application of stack?

a)

evaluation of post

b)

conversion of infix to postfix expression

c)

balancing symbols

d)

line at ticket counter

31.

What will be the output of the following C code?

1. #include <stdio.h>

2. int main()

3. {

4. enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};

5. printf("PEACH = %d\n", PEACH);

6. }

a)

PEACH = 3

b)

PEACH = 4

c)

PEACH = 5

d)

PEACH = 6

32.

What will be the output of the following C code?

1. #include <stdio.h>

2. int main()

3. {

4. int a = 1, b = 1;

5. switch (a)

6. {

7. case a*b:

8. printf("yes ");

9. case a-b:

10. printf("no\n");

11. break;

12. }

13. }

a)

yes

b)

no

c)

compile time error

d)

yes no

33.

1. #include <stdio.h>

2. int main()

3. {

4. printf("C programming %s", "Class by\n%s Sanfoundry", "WOW");

5. }

a)

C programming Class by WOW Sanfoundry

b)

C programming Class by\n%s Sanfoundry

c)

C programming Class by %s Sanfoundry

d)

Compilation error

34.

Can you combine the following two statements into one?

char *p;

p = (char*) malloc(100);

a)

char p = *malloc(100);

b)

char *p = (char) malloc(100);

c)

char *p = (char*)malloc(100);

d)

char *p = (char *)(malloc*)(100);

35.

What is the output of a C program with functions.?

void show();


void main()

{

show();

printf("RAINBOW ");

return;

}


void show()

{

printf("COLOURS ");

}

a)

RAINBOW COLOURS

b)

COLOURS RAINBOW

c)

COLOURS

d)

Compiler error

36.

What is the output of C Program with functions.?

int main()

{

int a=20;

printf("CINEMA ");

return 1;

printf("DINOSAUR");

return 1;

}

a)

CINEMA DINOSAUR

b)

CINEMA

c)

DINOSAUR

d)

Compiler error

37.

What would be the Prefix notation for the given equation?

A+(B*C)

a)

+A*CB

b)

*B+AC

c)

+A*BC

d)

*A+CB

38.

What would be the solution to the given prefix notation?

+ 9 * 3 / 8 4

a)

14

b)

15

c)

18

d)

12

39.

What would be the Prefix notation for the given equation?

(A*B)+(C*D)

a)

+*AB*CD

b)

*+AB*CD

c)

**AB+CD

d)

+*BA*CD

40.

The average depth of a binary tree is given as?

a)

O(N)

b)

O(log N)

c)

O(M log N)

d)

O(√N)

41.

An expression tree’s nodes can be deleted by calling?

a)

malloc

b)

calloc

c)

delete

d)

free

42.

What is the maximum number of possible non zero values in an adjacency matrix of a simple graph with n vertices?

a)

(n*(n-1))/2

b)

(n*(n+1))/2

c)

n*(n-1)

d)

n*(n+1)

43.

What does the following piece of code do?

public voidfunc(Tree root)

{

func(root.left());

func(root.right());

System.out.println(root.data());

}

a)

Preorder traversal

b)

Inorder traversal

c)

Postorder traversal

d)

Level order traversal

44.

Which of the following is not a collision resolution strategyfor open addressing?

a)

Linear probing

b)

Quadratic probing

c)

Double hashing

d)

Rehashing

45.

What is the worst case complexity of bubble sort?

a)

O(nlogn)

b)

O(logn)

c)

O(n)

d)

O(n2)