(Backup) DSA and Code Snippets

Quiz
•
Education
•
University
•
Hard

Shanmuga Priya M
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Which operation does the above code perform?
Enqueue
Dequeue
Return the front element
Both b and c
Answer explanation
Two operations are performed in the above code. The first one is returning the value of the front with the help of the statement n=q[front], and the second operation is dequeue (deleting an element) by using the statement front++.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The minimum number of stacks needed to implement a queue is
3
1
2
4
Answer explanation
Two stacks S1 & S2 are required to implement a queue.This method makes sure that newly entered element is always at the top of stack 1, so that DeQueue operation just pops from stack1. To put the element at top of stack1, stack2 is used.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which one of the following is the process of inserting an element in the stack?
Insert
Add
Push
None of the above
Answer explanation
In stack, the process of inserting an element is known as a push operation.
The process of deleting an element is known as a pop operation
4.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What is the height of the binary search tree (the height is the maximum distance of a leaf node from the root)?
2
3
4
6
Answer explanation
So, height of the tree is 3, option (B) is correct.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which data structure is required to convert the infix to prefix notation?
Stack
Linked List
Binary Tree
Queue
Answer explanation
Stack is a data structure used to reverse the order of the operators in the expression. It is also used as a storage structure that stores all the operators and print all the operators when all the operands have appeared
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Find the output of the given code.
4 7.97
4 7.96623
Compilation Error
None of the above
Answer explanation
In the above program the float variable ft is intialised to 7.96623
It rounded of to 7.97 because of %.2f in printf statement.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Find the output.
(Note: Consider it in 16 bit machine)
12 10
14 10
6 2
error
Answer explanation
In here the variable empid occupies 10 bytes because its an integer array with limit of 5 (5*2)
And the pointer variable occupies 2 bytes.
Therefore size of employee be
(5*2)+2+2=14 Bytes
Create a free account and access millions of resources
Similar Resources on Wayground
9 questions
cppp-2

Quiz
•
University
15 questions
Basics of Control Systems

Quiz
•
University
8 questions
7th quiz

Quiz
•
7th Grade - University
10 questions
Pandas Slicing Quiz1

Quiz
•
University
10 questions
Uji Coba Pemahaman Materi

Quiz
•
University
7 questions
11 SIM

Quiz
•
University
10 questions
Post_test

Quiz
•
University
15 questions
DSA & Code Snippets

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Education
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University