KLU- CLUSTER -4 DAY-6

KLU- CLUSTER -4 DAY-6

Professional Development

30 Qs

quiz-placeholder

Similar activities

Cars TESPA

Cars TESPA

Professional Development

31 Qs

UTS Bahasa Inggris Kelas 7 GASAL

UTS Bahasa Inggris Kelas 7 GASAL

Professional Development

25 Qs

Fry First Hundred Words

Fry First Hundred Words

Professional Development

25 Qs

X70 series online quiz

X70 series online quiz

Professional Development

35 Qs

Unit 7: Public transport

Unit 7: Public transport

Professional Development

27 Qs

CPS02-Day3-NWC -Set02

CPS02-Day3-NWC -Set02

Professional Development

30 Qs

Python Programming Quiz

Python Programming Quiz

Professional Development

25 Qs

ITC : Part of the airplanes

ITC : Part of the airplanes

University - Professional Development

25 Qs

KLU- CLUSTER -4 DAY-6

KLU- CLUSTER -4 DAY-6

Assessment

Quiz

English

Professional Development

Hard

Created by

CCC info@ccc.training

Used 3+ times

FREE Resource

30 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

following is C like pseudo-code of a function that takes a Queue as an argument, and uses a stack S to do processing.  void fun(Queue *Q) {     Stack S;  // Say it creates an empty stack S     while (!isEmpty(Q))     { push(&S, deQueue(Q));     }     while (!isEmpty(&S))     { enQueue(Q, pop(&S));     } } What does the above function do in general?
Removes the last from Q
Keeps the Q same as it was before the call
Makes Q empty
Reverses the Q

2.

MULTIPLE CHOICE QUESTION

1 min • 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) mod n == FRONT, empty: REAR == FRONT
Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR
Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT
Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following pseudo code. Assume that IntQueue is an integer queue. What does the function fun do?  void fun(int n) {     IntQueue q = new IntQueue();     q.enqueue(0);     q.enqueue(1);     for (int i = 0; i < n; i++)     {         int a = q.dequeue();         int b = q.dequeue();         q.enqueue(b);         q.enqueue(a + b);         print(a);     } }
Prints numbers from 0 to n-1
Prints numbers from n-1 to 0
Prints first n Fibonacci numbers
Prints first n Fibonacci numbers in reverse order.

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Let the following circular queue can accommodate maximum six elements with the following data.What will happen after ADD O operation takes place? front = 2 rear = 4 queue = _______; L, M, N, ___, ___
front = 2 rear = 5 queue = ______; L, M, N, O, ___
front = 3 rear = 5 queue = L, M, N, O, ___
front = 3 rear = 4 queue = ______; L, M, N, O, ___
front = 2 rear = 4 queue = L, M, N, O, ___

5.

MULTIPLE CHOICE QUESTION

1 min • 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) mod n == FRONT, empty: REAR == FRONT
Full: (REAR+1) mod n == FRONT, empty: (FRONT+1) mod n == REAR
Full: REAR == FRONT, empty: (REAR+1) mod n == FRONT
Full: (FRONT+1) mod n == REAR, empty: REAR == FRONT

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty and m > 0) { Dequeue(Q) m = m - 1 } } What is the worst case time complexity of a sequence of n MultiDequeue() operations on an initially empty queue?
Theta(n)
Theta(n + k)
Theta(nk)
Theta(n^2)

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

An implementation of a queue Q, using two stacks S1 and S2, is given below: void insert(Q, x) { push (S1, x); } void delete(Q){ if(stack-empty(S2)) then if(stack-empty(S1)) then { print(“Q is empty”); return; } else while (!(stack-empty(S1))){ x=pop(S1); push(S2,x); } x=pop(S2); } Let n insert and m (<=n) delete operations be performed in an arbitrary order on an empty queue Q. Let x and y be the number of push and pop operations performed respectively in the process. Which one of the following is true for all m and n?
n+m <= x < 2n and 2m <= y <= n+m
n+m <= x < 2n and 2m<= y <= 2n
n+m <= x < 2n and 2m<= y <= 2n
2m <= x <2n and 2m <= y <= 2n

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?