DataStructures Quiz-1

DataStructures Quiz-1

Professional Development

12 Qs

quiz-placeholder

Similar activities

sports

sports

KG - Professional Development

10 Qs

How Social Media is Applied

How Social Media is Applied

University - Professional Development

10 Qs

Moon Knight: What you have learned

Moon Knight: What you have learned

KG - Professional Development

11 Qs

Basic English Test

Basic English Test

KG - Professional Development

10 Qs

IFI WP MIP Establish Integrity Program

IFI WP MIP Establish Integrity Program

Professional Development

10 Qs

Happy birthday(Moduroti)

Happy birthday(Moduroti)

Professional Development

15 Qs

journey of a river

journey of a river

KG - Professional Development

15 Qs

GOAT Rappers Quiz

GOAT Rappers Quiz

KG - Professional Development

10 Qs

DataStructures Quiz-1

DataStructures Quiz-1

Assessment

Quiz

Other

Professional Development

Hard

Created by

Pallavi Girish

Used 2+ times

FREE Resource

AI

Enhance your content

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

12 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing.

void fun(int n)

{

    Stack S;  // Say it creates an empty stack S

    while (n > 0)

    {

      // This line pushes the value of n%2 to stack S

      push(&S, n%2);

 

      n = n/2;

    }

 

    // Run while Stack S is not empty

    while (!isEmpty(&S))

      printf("%d ", pop(&S)); // pop an element from S and print it

}

Prints binary representation of n in reverse order

Prints binary representation of n

Prints the value of Logn

Prints the value of Logn in reverse order

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which one of the following is an application of Stack Data Structure?

Managing function calls

The stock span problem

Arithmetic expression evaluation

All of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Consider the following pseudocode that uses a stack 

  • C

declare a stack of characters

while ( there are more characters in the word to read )

{

   read a character

   push the character on the stack

}

while ( the stack is not empty )

{

   pop a character off the stack

   write the character to the screen

}What is output for input "geeksquiz"?

geeksquizgeeksquiz

ziuqskeeg

geeksquiz

ziuqskeegziuqskeeg

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The following postfix expression with single digit operands is evaluated using a stack:

8 2 3 ^ / 2 3 + 5 1 -

Note that ^ is the exponentiation operator. The top two elements of the stack after the first * is evaluated are:

6, 1

5, 7

3, 2

1, 5

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl< top 2) point to the location of the topmost element in each of the stacks. If the space is to be used efficiently, the condition for “stack full” is (GATE CS 2004)

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

top1 + top2 = MAXSIZE

(top1= MAXSIZE/2) or (top2 = MAXSIZE)

top1= top2 -1

6.

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

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

To evaluate an expression without any embedded function calls :
 

As many stacks as the height of the expression tree are needed

One stack is enough

Two stacks are needed

A Turing machine is needed in the general case

Create a free account and access millions of resources

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

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?