
DataStructures Quiz-1
Quiz
•
Other
•
Professional Development
•
Hard
Pallavi Girish
Used 2+ times
FREE Resource
Enhance your content
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

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple

Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
12 questions
Kuis 19 Juli 2024
Quiz
•
Professional Development
10 questions
BIBLE QUIZ
Quiz
•
Professional Development
15 questions
DDM MCQ
Quiz
•
Professional Development
15 questions
Carpentry by Sir AL
Quiz
•
Professional Development
13 questions
GOFORTH QUIZ!
Quiz
•
Professional Development
10 questions
Quizizz - Finance Directorate Event
Quiz
•
Professional Development
10 questions
Dragon Mania Ledgends Quiz
Quiz
•
1st Grade - Professio...
13 questions
Juniors 2 -Ordinal Numbers-
Quiz
•
Professional Development
Popular Resources on Wayground
20 questions
Brand Labels
Quiz
•
5th - 12th Grade
11 questions
NEASC Extended Advisory
Lesson
•
9th - 12th Grade
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
10 questions
Boomer ⚡ Zoomer - Holiday Movies
Quiz
•
KG - University
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
Multiplication and Division Unknowns
Quiz
•
3rd Grade
20 questions
Multiplying and Dividing Integers
Quiz
•
7th Grade