#include<stdio.h>

struct student

{

int mark1;

char name[10];

} sub1={67};

void main()

{

printf("%s", sub1.name);

}

What will be the output of the above program?

“67”
67
NULL
Garbage value
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Consider a doubly linked list implemented as following:

typedef struct Node

{

int data;

struct Node *f, *b;

};

Where *f, and *b are forward and backward links to the adjacent nodes in the linked list.

Consider a pointer ‘middle’ pointing to a node in the list, which is neither the first nor the last node of the doubly linked list. Which among the following code segments deletes the node pointed by ‘middle’ pointer?

middle -> b -> f = middle -> f ; middle -> f -> b = middle -> b;
middle -> b -> b = middle -> f ; middle -> f -> f = middle -> b;
middle -> f -> b = middle -> f ; middle -> b -> f = middle -> b;
middle -> b -> f = middle -> b ; middle -> f -> b = middle -> f;
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Choose the correct option, from the following:

I) We can find a cycle in the graph using BFS.

II) We can find a cycle in the graph using DFS.

Only I is correct
Only II is correct
Both I and II are correct
None is correct.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
The number of different Unlabeled Binary Trees can be there with 4 nodes are ___
14
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
A program attempts to generate as many permutations as possible of the string, ‘abcd’ by pushing the characters m, n, q, r in the same order onto a stack, but it may pop off the top character at any time. Which one of the following strings CANNOT be generated using this program?
n r q m
m n r q
q r n m
None of the above
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include "stdio.h"

int main()

{

char a,b;

printf("%d", scanf("%c %c",&a, &b));

return 1;

}

What will be the output printed when the input given by the user to the program is “kt” on terminal?

1
2
0
Compiler error
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
int main()

{

int a = 333;

char *ptr;

ptr =( char *)&a;

printf("%d",*ptr);

return 0;

}

What will be the output of the above code?

64
77
75
76
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
#include<stdio.h>

int main()

{

static int i=5;

int j;

j=i+1;

if(--i)

{

main();

printf("%d",j);

}

}

What will be the output of the above program?

1111
3456
2345
0000
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
A function fun is called and it takes a 2 dimensional array arr as its parameter. arr has 5 rows and 5 columns. The correct function signature for the function fun among the following is/are? [MSQ]

[Assume that there are no complex error & warnings]

fun (int arr[])
fun (int (*arr)[])
fun (int arr[][5])
fun (int arr[5][])
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
#include <stdio.h>

void main()

{

int i=0,j=2,k=0

if (i && (j=i++))

k=1;

printf ("%d %d %d", i,j,k);

}

Output of the program is ?

0 1 1
0 2 0
0 0 1
1 0 1
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
#include<stdio.h>

void main()

{ int i=-1, j=-2,k ;

k=-i++*++j ;

printf("%d %d %d", i,j,k) ;

}

0 -1 -1
0 0 -1
1 0 1
1 1 1
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
#include<stdio.h>

void main()

{

int i=0;

for(;i<20 && printf("%d ",i);i++)

{

switch(i)

{

case 0 : i++; i*2;

case 20: i+=2;

case 70: i+=6;

default: i+=3;

}

}

What will be the output of the above program?

0 13 17
1 15 19
0 14 18
0 14 19
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the implementation of multiple stacks in single array S of size P from index 0 to P-1.

Size of each stack is Q. The following function PUSH(), used to push data x onto a particular stack i, where Ti is used as top variable for stack i(i indicates stack number).

PUSH(S,P,Q,Ti,x)

{

if(___A___)

{

printf(“stack overflow”);

exit(1);

}

else

Ti++;

S[Ti]=x;

}

Stack 0 stores elements from 0 to Q-1, stack 1 stores from q to 2Q-1 and similarly other stack will store elements. Which of the following is the correct expression to replace A in the above function?

Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
#include<stdio.h>

void fun(int x, int *p)

{

p=&x;

x=10;

}

void main()

{

int a=5, b=6;

int *p=&a, *q=&b;

*p=20;q=&p;

fun(a,&b);

*q=&b;

*p=30;

printf("%d %d\n",a,b);

}

What is the output of the above program?

10 20
20 30
30 30
30 10
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66
Consider the following infix expression:

(((P+Q)*(R+S))/T)+(A*(B+C))

What will be the minimum size of stack required to convert the above infix expression into postfix expression? _____

5
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Height of complete 10-ary tree with 10000 nodes is : ____
4
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Given a tree T. Choose a proper option which describes the tree. [MSQ]

T is BST but not AVL.
T is AVL & BST.

Inserting ‘g’ into T will violate AVL property.
Inserting ‘6’ into T will violate AVL property.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
What is the time complexity to find kruskal’s algorithm [MSQ]
O(ElogE)
O(ElogV)
O(E+V)
O(E^2 logV)^2
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
What is the time complexity for given code segment

O(log2n)
O(n)
O(n^2)
O(n^3)
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Let f(n)=n^3, g(n)=n^4 and h(n)=log(n!). Which of the following is true? [ MSQ ]
f(n) is not O(h(n)) and h(n) is not O(g(n))
f(n) is not O(h(n)) but h(n) is O(g(n))
g(n) is O(h(n)), but h(n) is not O(f(n))
h(n) is O(f(n)) and f(n) is O(g(n))
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.00
Running time of an algorithm T(n), where n is input size, is given by T(n)=24T(√n)+(logn)^2 if n>2 and T(n)=1 otherwise.

The algorithm is ordered by __?

θ(n^2)
θ(n^3)
θ(log2n)^4.58
θ(log2n)^5.48
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
A stable sort preserves the order of values that are equal with respect to the comparison function. We have a list of three dimensional points [(1, 2, 8),(2, 1, 7),(6, 5, 1),(5, 6, 2),(0, 2, 2),(9, 1, 9),(4,4,4)]. We sort these in ascending order by the second coordinate. Which of the following corresponds to a stable sort of this input?
[(9, 1, 9),(2, 1, 7),(1, 2, 8),(0, 2, 2),(4,4,4),(6, 5, 1),(5, 6, 2)]
[(2, 1, 7), (9, 1, 9),(0, 2, 2),(1, 2, 8),(4,4,4),(6, 5, 1),(5, 6, 2)]
[(2, 1, 7), (9, 1, 9),(1, 2, 8),(0, 2, 2),(4,4,4),(6, 5, 1),(5, 6, 2)]
[(9, 1, 9),(2, 1, 7),(0, 2, 2),(1, 2, 8),(4,4,4),(6, 5, 1),(5, 6, 2)]
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Given elements, Find the height of the optimal merge pattern?

17, 28, 13, 7, 8, 12, 10, 4

[ Hint: Height starts with 0 ]

4
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
Which of the following represents a binary max-heap?
25, 12, 16, 13, 10, 12, 4
25, 12, 13, 16, 4, 10, 12
25, 10, 13, 16, 4, 10, 12
25, 14, 16, 13, 10, 4, 12
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
While forming the Minimum Spanning Tree(MST) of the following graph using Prim's Algorithm, in what order will the edges be added?(Start from Vertex A)

A-C, C-E, E-F, C-G, G-B, B-D, E-H
A-B, A-E, E-F, C-G, G-B, B-D, E-H
A-E, A-B, E-F, C-G, G-B, B-D, E-H
A-C, A-B, B-D, C-G, G-B, A-E, E-F
Difficulty Level: 1
Positive Marks: 1.00
Negative Marks: 0.33
The Knapsack bag maximum Capacity is 20. Find out the difference between the number of used and unused objects when we find the maximum profit using greedy Knapsack___?

Objects

A

B

C

D

E

F

G

Weights

4

10

6

5

8

2

3

Profits

26

20

30

25

15

8

45

3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Given the frequencies and corresponding full binary tree using huffman code algorithm.

Character

A

B

C

D

E

F

Frequency

50

35

15

12

2

3

Find the difference between Y and X is _____?

3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
here are 2 strings named as X and Y, Find the length of the longest common subsequence(LCS) of the giving below two string X and Y is______

X = ababcdefe

Y = badbcefg

6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Which of the following statement(s) is/are FALSE? [ MSQ ]
Given a connected graph G = (V,E), if a vertex v ∈ V is visited during level k of a breadth-first search from source vertex s ∈ V, then every path from s to v has length at most k.
Any Dynamic Programming algorithm with n subproblems will run in O(n) time
Depth-first search will take Θ(V^2) time on a graph G = (V,E) represented as an adjacency matrix.
Given an adjacency-list representation of a directed graph G = (V,E), it takes O(V ) time to compute the in-degree of every vertex
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Which of the following statement(s) is/are FALSE? [ MSQ ]
Radix Sort does not work correctly (Means, It does not produce the correct output) if we sort each individual digit using insertion sort instead of counting sort.
Suppose we use a hash function ‘h’ to hash ‘n’ distinct keys into an array ‘’T’ of length ‘m’. Assuming simple uniform hashing, the expected number of colliding pairs of elements is θ(n^2/m)
Let T be a complete binary tree with n nodes. Finding a path from the root of T(T is not necessarily sorted) to a given vertex v ∈ T using breadth-first search takes O(logn) time.
Selection sort and heap sort satisfying stable property.
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
A min heap contains 512 distinct elements with keys ranging from 0 to 511. These keys are stored in an array of 512 indices. To place an element 25 in a min heap, find the maximum difference between maximum level and minimum level is____? [ Hint: Assume root as level 0 ]
8
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Suppose we are implementing quadratic probing with a Hash function, Hash(y)=X mod 100. If an element with key 4594 is inserted and the first three locations attempted are already occupied, then the next cell that will be tried is ____? [ Note: i >= 1 ]
3
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.00
Find the correct topological sequence using indegree elimination method for given graph G=(V,E)

1,6,5,0,3,2,4,7
0,1,3,7,2,4,5,6
1,7,6,5,0,3,2,4
0,5,7,2,3,1,4,6
Difficulty Level: 1
Positive Marks: 2.00
Negative Marks: 0.66