Time Left - 12:00 mins
Daily Practice Quiz-2:Data Structures
Attempt now to get your rank among 390 students!
Question 1
Assume a matrix is stored in a linear in row major order. Base address of A is 0 and each element takes 1 word. Find the location of A[–2] [50].
Question 2
What is the complexity of the efficient algorithm to construct a balanced BST from a given normal BST?
Question 3
The elements 32, 15, 20, 30, 12, 25, 16, are inserted one by one in the given order into a maxHeap. The resultant maxHeap is
Question 4
For the following binary tree, the corresponding 2 tree is
Question 5
Which one of the following Graphs is NOT planar?
Question 6
Which of the following is illegal statement ?
Question 7
Find the output
#include <iostream>
#define cnct(x,y) x##y
using namespace std;
class {
public:
int p,q,pq;
int f1()
{
cout<<p+q+pq+cnct(p,q)<<endl;
return (p+++q);
}
}c;
int main(){
c.p=5,c.q=6,c.pq=15;
cout<<c.f1();
return 0;
}
#include <iostream>
#define cnct(x,y) x##y
using namespace std;
class {
public:
int p,q,pq;
int f1()
{
cout<<p+q+pq+cnct(p,q)<<endl;
return (p+++q);
}
}c;
int main(){
c.p=5,c.q=6,c.pq=15;
cout<<c.f1();
return 0;
}
Question 8
Consider the following two functions.
void fun1 (int n) {
if (n == 0 ) return;
printf (“%d” , n);
fun2 (n - 2);
printf (“%d” , n);
}
void fun2 (int n) {
if (n = = 0) return ;
printf (“%d” , n);
fun1(++n) ;
printf (“%d” , n);
}
The output printed when fun1(5) is called is
void fun1 (int n) {
if (n == 0 ) return;
printf (“%d” , n);
fun2 (n - 2);
printf (“%d” , n);
}
void fun2 (int n) {
if (n = = 0) return ;
printf (“%d” , n);
fun1(++n) ;
printf (“%d” , n);
}
The output printed when fun1(5) is called is
Question 9
In which of the following notations of expressions does the processor takes least number of scans to evaluate expression.
Question 10
Consider a binary tree T that has 200 leaf nodes. Then, the numbers of nodes in T that have exactly two children are __________.
- 390 attempts
- 2 upvotes
- 3 comments
Jun 23GATE & PSU CS