DS CCW

DS CCW

University

10 Qs

quiz-placeholder

Similar activities

A-Level Computer Science Data Structures Quiz

A-Level Computer Science Data Structures Quiz

12th Grade - University

14 Qs

DataStructure

DataStructure

University

15 Qs

Data Structures

Data Structures

University

12 Qs

Heaps

Heaps

University

15 Qs

Trees

Trees

University

10 Qs

Circular queue

Circular queue

University

13 Qs

DS-U2-QUIZ2

DS-U2-QUIZ2

University

12 Qs

Data Structure

Data Structure

12th Grade - University

15 Qs

DS CCW

DS CCW

Assessment

Quiz

Computers

University

Hard

Created by

Yaduraj Yaduraj

Used 2+ times

FREE Resource

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following function in which start is pointing to the first node of the following linked list 1->2->3->4->5->6?

void fun(struct node* start)

{

if(start == NULL)

return;

printf("%d ", start->data);

if(start->next != NULL )

fun(start->next->next);

printf("%d ", start->data);

}

1 3 5

1 2 3 4

1 3 4 6

2 4 6

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Assume that the operators +,-,× are left associative and ^ is right associative. The order of precedence (from highest to lowest) is ^,x,+,-. The postfix expression corresponding to the infix expression a+b×c-d^e^f is

abc×+def^^-

abc×+de^f^-

ab+c×d-e^f^

-+a×bc^^def

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the following function do for a given binary tree?

int fun(struct node *root)

{

if (root == NULL)

return 0;

if (root->left == NULL && root->right == NULL)

return 0;

return 1 + fun(root->left) + fun(root->right);

}

Counts leaf nodes

Counts internal nodes

Returns height where height is defined as number of edges on the path from root to deepest node

Return diameter where diameter is number of edges on the longest path between any two nodes.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Following is an incorrect pseudocode for the algorithm which is supposed to determine whether a sequence of parentheses is balanced.

declare a character stack

while ( more input is available)

{

read a character

if ( the character is a '(' )

push it on the stack

else if ( the character is a ')' and the stack is not empty )

pop a character off the stack

else

print "unbalanced" and exit

}

print "balanced"

Which of these unbalanced sequences does the above code think is balanced?

((())

())((

(()()))

(()))()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Suppose a circular queue of capacity (n–1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR=FRONT=0. The conditions to detect queue full and queue empty are

Full:(REAR+1)modn==FRONT,empty:REAR==FRONT

Full:(REAR+1)modn==FRONT,empty:(FRONT+1)modn==REAR

Full:REAR==FRONT,empty:(REAR+1)modn==FRONT

Full:(FRONT+1)modn==REAR,empty:REAR==FRONT

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How many distinct binary search trees can be constructed out of 4 distinct keys?

5

14

24

35

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A Binary Search Tree is generated by inserting in order of the following integers. 50,15,62,5,20,58,91,3,8,37,60,24 The number of nodes in the left and right subtree of the root respectively is:

(4,7)

(7,4)

(8,3)

(3,8)

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?