DS CCW

DS CCW

University

10 Qs

quiz-placeholder

Similar activities

Computer Basics 2 - CESA

Computer Basics 2 - CESA

7th Grade - University

10 Qs

Node.js

Node.js

University

10 Qs

GUESS THE ANSWER

GUESS THE ANSWER

University

10 Qs

Software Testing

Software Testing

University

10 Qs

Chapter 2: Input Device

Chapter 2: Input Device

12th Grade - University

12 Qs

Hệ Điều Hành Của Máy Tính

Hệ Điều Hành Của Máy Tính

10th Grade - University

10 Qs

C++ Array Quiz

C++ Array Quiz

University

10 Qs

Information System and Modern Organization part 1

Information System and Modern Organization part 1

University

14 Qs

DS CCW

DS CCW

Assessment

Quiz

Computers

University

Practice Problem

Hard

Created by

Yaduraj Yaduraj

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

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)

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?