Fds Se Comp Techvines
Fds Se Comp Techvines
Unit-1
4. Variable name resolving (number of significant characters for uniqueness of variable) depends
on
a) Compiler and linker implementations
b) Assemblers and loaders implementations
c) C language
d) None
Answer:a
a) 1
b) 8
c) 9
d) 0
Answer: a
#include <stdio.h>
int main()
{
unsigned int a = 10;
a = ~a;
printf("%d\n", a);
}
a) -9
b) -10
c) -11
d) 10
Answer:c
#include <stdio.h>
int main()
{
if (7 & 8)
printf("Honesty");
if ((~7 & 0x000f) == 8)
printf("is the best policy\n");
}
#include <stdio.h>
int main()
{
int a = 2;
if (a >> 1)
printf("%d\n", a);
}
a) 0
b) 1
c) 2
d) No Output.
Answer:c
#include <stdio.h>
int main()
{
int i, n, a = 4;
scanf("%d", &n);
for (i = 0; i < n; i++)
a = a * 2;
}
#include <stdio.h>
void main()
{
int x = 97;
int y = sizeof(x++);
printf("x is %d", x);
}
a) x is 97
b) x is 98
c) x is 99
d) Run time error
Answer:a
#include <stdio.h>
void main()
{
int x = 4, y, z;
y = --x;
z = x--;
printf("%d%d%d", x, y, z);
}
a) 3 2 3
b) 2 2 3
c) 3 2 2
d) 2 3 3
Answer:d
#include <stdio.h>
void main()
{
int x = 4;
int *p = &x;
int *k = p++;
int r = p - k;
printf("%d", r);
}
a) 4
b) 8
c) 1
d) Run time error
Answer:c
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = (y++) ? y == 1 && x : 0;
printf("%d\n", z);
return 0;
}
a) 0
b) 1
c) Undefined behaviour
d) Compile time error
Answer:a
#include <stdio.h>
int main()
{
int x = 1;
int y = x == 1 ? getchar(): 2;
printf("%d\n", y);
}
#include <stdio.h>
int main()
{
int x = 1;
short int i = 2;
float f = 3;
if (sizeof((x == 2) ? f : i) == sizeof(float))
printf("float\n");
else if (sizeof((x == 2) ? f : i) == sizeof(short int))
printf("short int\n");
}
a) float
b) short int
c) Undefined behaviour
d) Compile time error
Answer:a
#include <stdio.h>
int main()
{
int a = 2;
int b = 0;
int y = (b == 0) ? a :(a > b) ? (b = 1): a;
printf("%d\n", y);
}
#include <stdio.h>
int main()
{
int y = 1, x = 0;
int l = (y++, x++) ? y : x;
printf("%d\n", l);
}
a) 1
b) 2
c) Compile time error
d) Undefined behaviour
Answer:a
#include <stdio.h>
void main()
{
int k = 8;
int m = 7;
int z = k < m ? k = m : m++;
printf("%d", z);
}
d) Depends on compiler
Answer:b
#include <stdio.h>
void main()
{
1 < 2 ? return 1 : return 2;
}
a) returns 1
b) returns 2
c) Varies
d) Compile time error
Answer:d
a) No difference as space doesn’t make any difference, values of a, b, d are same in both the
case
b) No difference as space doesn’t make any difference, values of a, b, d are different
c) Program 1 has syntax error, program 2 is not
d) Program 2 has syntax error, program 1 is not
b) Answer:a
#include <stdio.h>
int main()
{
int a = 1, b = 1, c;
c = a++ + b;
printf("%d, %d", a, b);
}
a) a = 1, b = 1
b) a = 2, b = 1
c) a = 1, b = 2
d) a = 2, b = 2
Answer:b
#include <stdio.h>
int main()
{
int a = 1, b = 1, d = 1;
printf("%d, %d, %d", ++a + ++a+a++, a++ + ++b, ++d + d++ + a++);
}
a) 15, 4, 5
b) 9, 6, 9
c) 9, 3, 5
d) 6, 4, 6
Answer:a
#include <stdio.h>
int main()
{
int a = 10, b = 10;
if (a = 5)
b--;
printf("%d, %d", a, b--);
}
a) a = 10, b = 9
b) a = 10, b = 8
c) a = 5, b = 9
d) a = 5, b = 8
Answer:c
#include <stdio.h>
int main()
{
int i = 0;
int j = i++ + i;
printf("%d\n", j);
}
a) 0
b) 1
c) 2
d) Compile time error
Answer:a
27. What is the output of this C code?
#include <stdio.h>
int main()
{
int i = 2;
int j = ++i + i;
printf("%d\n", j);
}
a) 6
b) 5
c) 4
d) Compile time error
Answer:a
#include <stdio.h>
int main()
{
int i = 2;
int i = i++ + i;
printf("%d\n", i);
}
32. Preprocessor feature that supply line numbers and filenames to compiler is called?
a) Selective inclusion
b) macro substitution
c) Concatenation
d) Line control
Answer:d
33. #include are _______ files and #include “somefile.h” ________ files.
a) Library, Library
b) Library, user-created header
c) User-created header, library
d) They can include all types of file
Answer:d
35.The sequence of allocation and deletion of variables for the following code is.
#include <stdio.h>
int main()
{
int a;
{
int b;
}
}
a) a->b, a->b
b) a->b, b->a
c) b->a, a->b
d) b->a, b->a
Answer:b
42. Array sizes are optional during array declaration by using ______ keyword.
a) auto
b) static
c) extern
d) register
#include <stdio.h>
void main()
{
int x = 3;
{
x = 4;
printf("%d", x);
}
}
a) 4
b) 3
c) 0
d) Undefined
Answer:a
#include <stdio.h>
int x = 5;
void main()
{
int x = 3;
m();
printf("%d", x);
}
void m()
{
x = 8;
n();
}
void n()
{
printf("%d", x);
}
a) 8 3
b) 3 8
c) 8 5
d) 5 3
Answer:a
45. What is the output of this C code?
#include <stdio.h>
int x;
void main()
{
m();
printf("%d", x);
}
void m()
{
x = 4;
}
a) 0
b) 4
c) Compile time error
d) Undefined
Answer:b
#include <stdio.h>
static int x = 5;
void main()
{
int x = 9;
{
x = 4;
}
printf("%d", x);
}
a) 9
b) 5
c) 4
d) 0
Answer:c
#include <stdio.h>
void main()
{
{
int x = 8;
}
printf("%d", x);
}
a) 8
b) 0
c) Undefined
d) Compile time error
Answer:d
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y || z++;
printf("%d", z);
}
a) 6
b) 5
c) 0
d) Varies
Answer:a
#include <stdio.h>
void main()
{
int x = 1, y = 0, z = 5;
int a = x && y && z++;
printf("%d", z);
}
a) 6
b) 5
c) 0
d) Varies
50. What is the output of this C code?
#include <stdio.h>
int main()
{
int x = 1, y = 0, z = 3;
x > y ? printf("%d", z) : return z;
}
a) 3
b) 1
c) Compile time error
d) Run time error
51. What is the output of this C code(when 1 is entered)?
#include <stdio.h>
void main()
{
double ch;
printf("enter a value btw 1 to 2:");
scanf("%lf", &ch);
switch (ch)
{
case 1:
printf("1");
break;
case 2:
printf("2");
break;
}
}
#include <stdio.h>
void main()
{
char *ch;
printf("enter a value btw 1 to 3:");
scanf("%s", ch);
switch (ch)
{
case "1":
printf("1");
break;
case "2":
printf("2");
break;
}
}
a) 1
b) Compile time error
c) 2
d) Run time error
Answer:b
#include <stdio.h>
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
default:
printf("2\n");
}
}
a) 1
b) 2
c) 1 2
d) Run time error
Answer:c
#include <stdio.h>
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch)
{
case 1:
printf("1\n");
break;
printf("hi");
default:
printf("2\n");
}
}
a) 1
b) hi 2
c) Run time error
d) 2
Answer:d
#include <stdio.h>
void main()
{
int ch;
printf("enter a value btw 1 to 2:");
scanf("%d", &ch);
switch (ch, ch + 1)
{
case 1:
printf("1\n");
break;
case 2:
printf("2");
break;
}
}
a) 1
b) 2
c) 3
d) Run time error
Answer:b
#include <stdio.h>
int main()
{
int a = 1, b = 1;
switch (a)
{
case a*b:
printf("yes ");
case a-b:
printf("no\n");
break;
}
}
a) yes
b) no
c) Compile time error
d) yes no
Answer:c
#include <stdio.h>
int main()
{
int x = 97;
switch (x)
{
case 'a':
printf("yes ");
break;
case 97:
printf("no\n");
break;
}
}
a) yes
b) yes no
c) Duplicate case value error
d) Character case value error
Answer:c
#include <stdio.h>
int main()
{
float f = 1;
switch (f)
{
case 1.0:
printf("yes\n");
break;
default:
printf("default\n");
}
}
a) yes
b) yes default
c) Undefined behaviour
d) Compile time error
Answer:d
#include <stdio.h>
void main()
{
int x = 1, z = 3;
int y = x << 3;
printf(" %d\n", y);
}
a) -2147483648
b) -1
c) Run time error
d) 8
Answer:d
#include <stdio.h>
void main()
{
int x = 0, y = 2, z = 3;
int a = x & y | z;
printf("%d", a);
}
a) 3
b) 0
c) 2
d) Run time error
Answer:a
#include <stdio.h>
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
exit(0);
printf("%d\n", i);
return reverse(i++);
}
a) 1 2 3 4 5
b) 1 2 3 4
c) Compile time error
d) Stack overflow
Answer:d
#include <stdio.h>
void reverse(int i);
int main()
{
reverse(1);
}
void reverse(int i)
{
if (i > 5)
return ;
printf("%d ", i);
return reverse((i++, i));
}
a) 1 2 3 4 5
b) Segmentation fault
c) Compilation error
d) Undefined behaviour
Answer:a
63. In expression i = g() + f(), first function called depends on
a) Compiler
b) Associativiy of () operator
c) Precedence of () and + operator
d) Left to write of the expression
Answer:a
#include <stdio.h>
int x = 0;
int main()
{
int i = (f() + g()) || g();
int j = g() || (f() + g());
}
int f()
{
if (x == 0)
return x + 1;
else
return x - 1;
}
int g()
{
return x++;
}
#include <stdio.h>
int x = 0;
int main()
{
int i = (f() + g()) | g(); //bitwise or
int j = g() | (f() + g()); //bitwise or
}
int f()
{
if (x == 0)
return x + 1;
else
return x - 1;
}
int g()
{
return x++;
}
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = y && (y |= 10);
printf("%d\n", z);
return 0;
}
a) 1
b) 0
c) Undefined behaviour due to order of evaluation
d) 2
Answer:a
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = (y++) ? 2 : y == 1 && x;
printf("%d\n", z);
return 0;
}
a) 0
b) 1
c) 2
d)Undefined behaviour
Answer:b
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z;
z = (y++, y);
printf("%d\n", z);
return 0;
}
a) 0
b) 1
c) Undefined behaviour
d) Compilation error
Answer:b
#include <stdio.h>
int main()
{
int x = 2, y = 0, l;
int z;
z = y = 1, l = x && y;
printf("%d\n", l);
return 0;
}
a) 0
b) 1
c) Undefined behaviour due to order of evaluation can be different
d) Compilation error
Answer:b
#include <stdio.h>
int main()
{
int y = 2;
int z = y +(y = 10);
printf("%d\n", z);
}
a) 12
b) 20
c) 4
d) Either 12 or 20
Answer:b
#include <stdio.h>
int main()
{
int i = 0, j = 0;
if (i && (j = i + 10))
//do something
;
}
a) 0
b) 10
c) Depends on the compiler
d) Depends on language standard
Answer:a
#include <stdio.h>
int main()
{
int i = 10, j = 0;
if (i || (j = i + 10))
//do something
;
}
a) 0
b) 20
c) Compile time error
d) Depends on language standard
Answer:a
#include <stdio.h>
int main()
{
int i = 1;
if (i++ && (i == 1))
printf("Yes\n");
else
printf("No\n");
}
a) Yes
b) No
c) Depends on the compiler
d) Depends on the standard
Answer:b
75. What is the output of the below code considering size of short int is 2, char is 1 and int is 4
bytes?
#include <stdio.h>
int main()
{
short int i = 20;
char c = 97;
printf("%d, %d, %d\n", sizeof(i), sizeof(c), sizeof(c + i));
return 0;
}
a) 2, 1, 2
b) 2, 1, 1
c) 2, 1, 4
d) 2, 2, 8
Answer:c
77. What will be the data type of the result of the following operation?
(float)a * (int)b / (long)c * (double)d
a) int
b) long
c) float
d) double
Answer:d
78. Which of the following type-casting have chances for wrap around?
a) From int to float
b) From int to char
c) From char to short
d) From char to int
Answer:b
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1)
printf("equal\n");
else
printf("not equal\n");
}
a) equal
b) not equal
c) Output depends on compiler
d) None of the mentionedAnswer:b
#include <stdio.h>
int main()
{
float f1 = 0.1;
if (f1 == 0.1f)
printf("equal\n");
else
printf("not equal\n");
}
a) equal
b) not equal
c) Output depends on compiler
d) None of the mentionedAnswer:a
83. What is the output of this C code (on a 32-bit machine)?
#include <stdio.h>
int main()
{
int x = 10000;
double y = 56;
int *p = &x;
double *q = &y;
printf("p and q are %d and %d", sizeof(p), sizeof(q));
return 0;
}
#include <stdio.h>
union Sti
{
int nu;
char m;
};
int main()
{
union Sti s;
printf("%d", sizeof(s));
return 0;
}
a) 8
b) 5
c) 9
d) 4Answer:d
#include <stdio.h>
int main()
{
float x = 'a';
printf("%f", x);
return 0;
}
a) a
b) run time error
c) a.0000000
d) 97.000000
Answer:d
Answer:b
#include <stdio.h>
void main()
{
int a = 3;
int b = ++a + a++ + --a;
printf("Value of b is %d", b);
}
a) Value of x is 12
b) Value of x is 13
c) Value of x is 10
d) Undefined behaviour
Answer:d
Answer:a
Answer:c
#include <stdio.h>
int main()
{
int x = 2, y = 2;
float f = y + x /= x / y;
printf("%d %f\n", x, f);
return 0;
}
a) 2 4.000000
b) Compile time error
c) 2 3.500000
d) Undefined behaviour
Answer:b
#include <stdio.h>
int main()
{
int x = 1, y = 2;
if (x && y == 1)
printf("true\n");
else
printf("false\n");
}
a) true
b) false
c) Compile time error
d) Undefined behaviour
Answer:b
#include <stdio.h>
int main()
{
int x = 1, y = 2;
int z = x & y == 2;
printf("%d\n", z);
}
a) 0
b) 1
c) Compile time error
d) Undefined behaviour
Answer:b
#include <stdio.h>
int main()
{
int x = 3, y = 2;
int z = x /= y %= 2;
printf("%d\n", z);
}
a) 1
b) Compile time error
c) Floating point exception
d) Segmentation fault
Answer:c
#include <stdio.h>
int main()
{
int x = 3, y = 2;
int z = x << 1 > 5;
printf("%d\n", z);
}
a) 1
b) 0
c) 3
d) Compile time error
Answer:a
Answer:c
#include <stdio.h>
int main()
{
int x = 2, y = 2;
int z = x ^ y & 1;
printf("%d\n", z);
}
a) 1
b) 2
c) 0
d) 1 or 2
Answer:b
#include <stdio.h>
int main()
{
int x = 2, y = 0;
int z = x && y = 1;
printf("%d\n", z);
}
a) 0
b) 1
c) Compile time error
d) 2
Answer:c
#include <stdio.h>
int main()
{
int x = 0, y = 2;
if (!x && y)
printf("true\n");
else
printf("false\n");
}
a) true
b) false
c) Compile time error
d) Undefined behaviour
Answer:a
#include <stdio.h>
int main()
{
int x = 0, y = 2;
int z = ~x & y;
printf("%d\n", z);
}
a) -1
b) 2
c) 0
d) Compile time error
Answer:b
Data Structure Multiple Choice Questions & Answers Pdf
Question: 1
(A) Array
(B) Stack
Ans: C
Linked list
Question: 2
(B) Heap
(C) Stack
(D) Queue
Ans: D
Queue
Question: 3
(A) Queue
(C) Tree
(D) Stack
Ans: B
Linked list
Question: 4
Ans: C
Question: 5
Ans: A
Input file
Data Structure Objective Questions & Answers Pdf
Question: 1
Ans: A
Bubble sort
Question: 2
(A) B-tree
(C) Graph
Ans: C
Graph
Question: 3
Which of the following statement is not true about linked lists?
Ans: A
Question: 4
(A) Stack
(B) Queue
Ans: D
Binary tree
Question: 5
Which of the following data structure permits insertion and
deletion operations only on one end of the structure?
(B) Array
(C) Stack
(D) Queue
Ans: C
Stack
Data Structure Questions & Answers Pdf
Question: 1
Ans: C
Linear Array
Question: 2
(A) 2
(B) 3
(C) 4
Ans: B
3
Question: 3
Ans: A
Complete graph
Question: 4
(C) Sink
Ans: C
Sink
Question: 5
(C) Planar
Ans: B
Contains no cycles
Data Structure Quiz Questions & Answers Pdf
Question: 1
Linked list
Question: 2
Queue
Question: 3
Linked list
Question: 4
Question: 5
Input file
Question: 6
Which of the following sorting algorithm is the slowest?
Bubble sort
Question: 7
Graph
Question: 8
Question: 9
Binary tree
Question: 10
Stack
MCQs
a) 3 and 5
b) 5 and 3
c) 2 and 4
d) 4 and 2
Answer: a
Explanation: Array indexing starts from 0.
a) 4
b) 5
c) ArrayIndexOutOfBoundsException
d) InavlidInputException
Answer: c
Explanation: Trying to access an element beyond the limits of an array gives
ArrayIndexOutOfBoundsException.
Queues:
1. A linear list of elements in which deletion can be done from one end (front) and insertion can
take place only at the other end (rear) is known as a ?
a) Queue
b) Stack
c) Tree
d) Linked list
Answer: a
Explanation: Self Explanatory.
3. A queue is a ?
a) FIFO (First In First Out) list
b) LIFO (Last In First Out) list
c) Ordered array
d) Linear tree
View Answer
Answer: a
Explanation: Self Explanatory.
4. In Breadth First Search of Graph, which of the following data structure is used?
a) Stack
b) Queue
c) Linked list
d) None of the mentioned
View Answer
Answer: b
Explanation: Self Explanatory.
5. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in
what order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABCD
Answer: a
Explanation: Queue follows FIFO approach.
6. A data structure in which elements can be inserted or deleted at/from both the ends but not in
the middle is?
a) Queue
b) Circular queue
c) Dequeue
d) Priority queue
Answer: c
Explanation: Self Explanatory.
7. A normal queue, if implemented using an array of size MAX_SIZE, gets full when
a) Rear = MAX_SIZE – 1
b) Front = (rear + 1)mod MAX_SIZE
c) Front = rear + 1
d) Rear = front
Answer: a
Explanation: Condition for size of queue.
10. In linked list implementation of queue, if only front pointer is maintained, which of the
following operation take worst case linear time?
a) Insertion
b) Deletion
c) To empty a queue
d) Both a and c
Answer: d
Explanation: Since front pointer is used for deletion, so worst time for the other two cases.
11. In linked list implementation of a queue, where does a new element be inserted?
a) At the head of link list
b) At the centre position in the link list
c) At the tail of the link list
d) None of the mentioned
Answer: c
Explanation: Since queue follows FIFO so new element inserted at last.
12. In linked list implementation of a queue, front and rear pointers are tracked. Which of these
pointers will change during an insertion into a NONEMPTY queue?
a) Only front pointer
b) Only rear pointer
c) Both front and rear pointer
d) None of the mentioned
Answer: b
Explanation: Since queue follows FIFO so new element inserted at last.
1)Which of the following type of operators have higher precedence_____
a)Relational operators b)equality operators
c)Logical operators d)Arithmatic operators
ans-Arithmatic operators
4)If a,b,c are integer variables with values 1,2,3 respectively, then what is the value
of the expression
!((a+5)<(b+c))
a)0 b)6 c)5 d)1
ans-1
Q24) Flowcharts can show errors in ____ which is not readily visible in the other
charts.
A) Arithmetic operations
B) Logic
C) Code
D) All of these
Ans. (B)
Q25) Which equation is to be satisfied to find the BIG-O?
A) F(n)=c*g(n)
B) F(n)>=c*g(n)
C) F(n)<=c*g(n)
D) None
ANS:C
d) none of these
a) define-calling-declaration
b) declaration-define-calling
c) calling-define-declaration
d) none of these
Q.36. The function written by the user according to requirement
known As…………..
a) datatype array_name[size]
d) none of these
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
((OPTION_A)) 2,1,15
((OPTION_B)) 1,2,5
((OPTION_C)) 3,2,15
((OPTION_D)) 2,3,20
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION)) Step 1: int a[5] = {5, 1, 15, 20, 25}; The variable arr is declared as an
(OPTIONAL) integer array with a size of 5 and it is initialized to
a[0] = 5, a[1] = 1, a[2] = 15, a[3] = 20, a[4] = 25 .
Step 2: int i, j, m; The variable i,j,m are declared as an integer type.
Step 3: i = ++a[1]; becomes i = ++1; Hence i = 2 and a[1] = 2
Step 4: j = a[1]++; becomes j = 2++; Hence j = 2 and a[1] = 3.
Step 5: m = a[i++]; becomes m = a[2]; Hence m = 15 and i is
incremented by 1(i++ means 2++ so i=3)
Step 6: printf("%d, %d, %d", i, j, m); It prints the value of the
variables i, j, m
Hence the output of the program is 3, 2, 15
((MARKS)) (1/2/3...) 1
((QUESTION)) In C, if you pass an array as an argument to a function, what actually gets
passed?
((OPTION_A)) Value of elements in array
((OPTION_B)) First element of the array
((CORRECT_CHOICE)) C
(A/B/C/D)
((MARKS)) (1/2/3...) 1
Which of the following statements are correct about 6 used in the
((QUESTION))
program?
int num[6];
num[6]=21;
((OPTION_A)) In the first statement 6 specifies a particular element, whereas in the
second statement it specifies a type.
((OPTION_B)) In the first statement 6 specifies a array size, whereas in the second
statement it specifies a particular element of array.
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION)) The statement 'B' is correct, because int num[6]; specifies the size of
(OPTIONAL) array and num[6]=21; designates the particular element(7thelement) of
the array.
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) 1
((OPTION_B)) 1,4
((OPTION_C)) 2,3
((OPTION_D)) 2,4
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION)) 1. The array int num[26]; can store 26 elements. This statement is
(OPTIONAL) true.
2. The expression num[1] designates the very first element in the
array. This statement is false, because it designates the second
element of the array.
3. It is necessary to initialize the array at the time of declaration. This
statement is false.
4. The declaration num[SIZE] is allowed if SIZE is a macro. This
statement is true, because the MACRO just replaces the symbol SIZE
with given value.
Hence the statements '1' and '4' are correct statements.
((MARKS)) (1/2/3...) 1
((OPTION_C)) Range
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) Which of the following function is used to find the first occurrence of a
given string in another string?
((OPTION_A)) strchr()
((OPTION_B)) strrchr()
((OPTION_C)) strstr()
((OPTION_D)) strnset()
((CORRECT_CHOICE)) C
(A/B/C/D)
((MARKS)) (1/2/3...) 1
((OPTION_A)) BIG-O
((OPTION_B)) Omega
((OPTION_C)) Phi
((OPTION_D)) Theta
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) 5 times
((OPTION_C)) Infinite
((OPTION_D)) No execution
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_D)) None
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Facebook
((OPTION_B)) Searching
((OPTION_C)) Sorting
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Queue
((OPTION_B)) Stack
((OPTION_C)) Array
((OPTION_D)) List
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_B)) O(log n)
((OPTION_C)) O(n)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) +
((OPTION_B)) /
((OPTION_C)) %
((OPTION_D)) *
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Allloc()
((OPTION_B)) Malloc()
((OPTION_C)) Calloc()
((OPTION_D)) Free()
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) Which of the following case does not exist in complexity theory
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
The Worst case occur in linear search algorithm when
((QUESTION))
((OPTION_D)) Item is the last element in the array or is not there at all
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION)) .
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) O(n)
((OPTION_B)) O(log n)
((OPTION_C)) O(n2)
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) The input to a merge sort is 6,5,4,3,2,1 and the same input is applied to
quick sort then which is the best algorithm in this case
((OPTION_C)) Both have same time complexity in this case as they have same running
time
((OPTION_D)) Cannot be decided
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
If there exists two functions f(n) and g(n). The constant c>0 and there exists
((QUESTION))
an integer constant n0>=1. If f(n)<=c*g(n) for every integer n>= n0 then we
say that____
((OPTION_A)) f(n)=O(g(n))
((CORRECT_CHOICE)) A
(A/B/C/D)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Big oh
((CORRECT_CHOICE)) A
(A/B/C/D)
((CORRECT_CHOICE)) D
(A/B/C/D)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION)) Within two for loops(nested), all these operations are performed.
(OPTIONAL)
((MARKS)) (1/2/3...) 1
while(n>0)
{
n=n/10
}
((OPTION_A)) O(1)
((OPTION_B)) O(n)
((OPTION_C)) O(log n)
((OPTION_D)) O(n2)
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((OPTION_A)) O(n)
((OPTION_B)) O(log n)
((OPTION_D)) O(n2)
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION)) The list is divided at the mid and then the element is searched in
(OPTIONAL) either left half or right half.
((MARKS)) (1/2/3...) 1
((OPTION_A)) O(n)
((OPTION_B)) O(log n)
((OPTION_C)) O(n log n)
((OPTION_D)) O(n2)
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION)) T(n)=T(n-1)+c2
(OPTIONAL) =T(n-2)+2c2
=T(n-3)+3c2
=T(n-k)+kc2
If k=n then T(n)=c1+nc2 Hence, T(n)=O(n)
((MARKS)) (1/2/3...) 1
((OPTION_A)) O(n)
((OPTION_B)) O(log n)
((OPTION_D)) O(n2)
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
The recurrence relation for factorial function is of the form _______
((QUESTION))
((OPTION_A)) T(n)=T(n-1)+c
((OPTION_B)) T(n)=T(n-1)+T(n-2)+c
((OPTION_C)) T(n/2)+c
((CORRECT_CHOICE)) A
(A/B/C/D)
((MARKS)) (1/2/3...) 1
((QUESTION)) The recurrence relation for fibonacci function is of the form _______
((OPTION_A)) T(n)=T(n-1)+c
((OPTION_B)) T(n)=T(n-1)+T(n-2)+c
((OPTION_C)) T(n/2)+c
((CORRECT_CHOICE)) B
(A/B/C/D)
((MARKS)) (1/2/3...) 1
((OPTION_A)) m + mn + mn
((OPTION_B)) m + n + mn
((OPTION_C)) m + n2 + mn
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) T(n)=O(n4)
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
for(i=1;i<=n;i++)
for(j=1;j<=i;j++)
x=x+1;
((OPTION_A)) ½(n2+n)
((OPTION_B)) ½(n2+3n)
((OPTION_C)) n2
((OPTION_D)) (n+1)2
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) There are four algorithms for solving a problem. Their time complexities
are O(n), O(n2), O(log n) and O(n log n). Which is the best algorithm?
((OPTION_A)) O(n)
((OPTION_B)) O(n2)
((OPTION_C)) O(log n)
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) 3
((OPTION_B)) 2
((OPTION_C)) 1
((OPTION_D)) B
((CORRECT_CHOICE)) D
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) 1, -1
((OPTION_B)) -1, -1
((OPTION_C)) 1, 1
((OPTION_D)) None of these
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Z2-3Z-2=0
((OPTION_B)) Z2+3Z-2=0
((OPTION_C)) Z2+3Z+2=0
((CORRECT_CHOICE)) C
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) ar=c1(-2)r
((OPTION_B)) ar=c2(2)r
((OPTION_C)) ar=c1(1)r
((CORRECT_CHOICE)) B
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) Consider the recurrence relation, an=an-1+2an-2 with a9=3 and a10=5. Find a7.
((OPTION_A)) 1
((OPTION_B)) 3
((OPTION_C)) 5
((OPTION_D)) None
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((OPTION_A)) Z-1=0
((OPTION_B)) Z2-1=0
((OPTION_C)) (Z-1)2=0
((OPTION_D)) None
((CORRECT_CHOICE)) D
(A/B/C/D)
((OPTION_A)) ab+cd-*
((OPTION_B)) ab+cd*-
((OPTION_C)) abcd+*-
((OPTION_D)) ab-cd+*
((CORRECT_CHOICE)) A
(A/B/C/D)
((EXPLANATION))
(OPTIONAL)
((MARKS)) (1/2/3...) 1
((QUESTION)) What does the following function check for? (all necessary headers to
be included and function is called from main)
#define MAX 10
Suppose we are sorting an array of eight integers using a some quadratic sorting
algorithm. After four iterations of the algorithm’s main loop, the array elements are
ordered as shown here:2 4 5 7 8 1 3 6 *
Insertion sort
Selection sort
either of a and b
none of the above
A sort which compares adjacent elements in a list and switches where necessary is *
insertion sort
heap sort
quick sort
bubble sort
The correct order of the efficiency of the following sorting algorithms according to their
overall running time comparision is *
Insertion>selection>bubble
Insertion>bubble>selection
Selection>bubble>insertion
bubble>selection>insertion
A sort which iteratively passes through a list to exchange the first element with any
element less than it and then repeats with a new first element is called *
insertion sort
selection sort
heap sort
quick sort
The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in
ascending order, using bubble sort is *
10
9
13
14
The way a card game player arranges his cards as he picks them one by one can be
compared to *
Quick sort
Merge sort
Insertion sort
Bubble sort
Which among the following is the best when the list is already sorted *
Insertion sort
Bubble sort
Merge sort
Selection sort
As part of the maintenance work, you are entrusted with the work of rearranging the
library books in a shelf in proper order, at the end of each day. The ideal choice will
be *
Bubble sort
Insertion sort
Selection sort
Merge sort
JSPM's
Jayawantrao Sawant College Of Engineering, Hadapsar,Pune-28
Department of Information Technology
{}
Ans D
6) How to call a function without using the function name to send parameters?
a) typedefs
b) Function pointer
c) Both (a) and (b)
d) None of the mentioned
Answer:b
Answer:d
#include <stdio.h>
void first()
{
printf("Hello World");
}
void main()
{
void *ptr() = first;
ptr++
ptr();
}
Answer:c
void main()
{
Inta[]={1,2,3,4,5},j;
For(j=0;j<5;j++)
{
Printf(“%d”,*a);
a++;
}
}
a) Syntax error
b) Run time error
c) 12345
d) Garbage 1234
#include<stdio.h>
Void main()
{
Int a=10;
Int*b=&a;
Int**c=&b;
**c=20;
Printf(“%d”,a);
}
a) 10
b) 20
c) Garbage value
d) Syntax error
Void main()
{
Intarr[]={10,20,30};
Int *p=arr;
Int *q=&p;
Printf(“%d”,(**q));
}
a) 10
b) 20
c) Sytax error
d) Runtime error
Intmain()
{
Char *str;
Str=”%d\n”;
Str++;
Str++;
Printf(str-2,500);
Return 0;
}
a) 5
b) 50
c) 500
d) No o/p
a) 7
b)127
c)255
d)no limit Ans:d
Intmain()
{
Int i=10,*a;
Void *b;
a=b=&i;
printf(“%u%u”,a++,b++);
return 0;
}
a) 10 garbage value
b) Add will be display twice
c) Syntax error
d) None of these
a. C
b. Fortron
c. Pascal
d. Both b&c ans:d
17)Identify invalid expression
a)&274
b)&(a+b)
c)&(a*b)
18)main()
Int a=5;
Ptr=&a;
Printf(“%d”,++*ptr);
a)6
b)5
c)0
d)none
ans:a
a) 0
b) 1
c) 2
d) 3
ans:1
20) The no. Of argument use in realloc is
a) 0
b) 1
c) 2
d) 3
ans:c
21) the function is use in dynamic deallocation is
a) Destroy()
b) Delet()
c) Free
d) Remove()
ans:c
d) Invalid
ans:a
a) An ordinary array
b) A pointer to an array
c) Ann array to an pointer
d) Pointer to an array
ans:c
26) Given int a[5][5];identify the correct expression ,yielding the starting element.
a) *a[0]
b) **a
c) a[0][0]
d) all of these
ans:d
ans:b
29) main()
{
Inta[5]={-2,-1,3,4,5}
Int*b;
b=&a[2];
}
Then value of b[-1] is:
a) 4
b) 3
c) -1
d) -2
ans:c
30)identify invalid pointer oprator
a) &
b)>>
c) *
d)None of these
ans:b
a)int *p,a=10;
b)int a=10,*p=&a;
c)int *p=&a,a=10
d)options a and b
intnum=15,*p=#
a)*num
b)*(&num)
c)*&*&num
d)**&p
a)&y
b)*&x
c)**&y
d)(*&)x
a)a constant
b)an expression
b)lvalue
d)rvalue
b)lvalue
d)rvalue
39)The operand of indirection operator is
a)pointer variable
b)pointer expression
d)ordinary variable
a)*(p+1)
b)*(p-3)
d)&x
a)0
b)undefined
c)1
d)-1
44)Given the declaration double prec[5]; the address of element prec[2]is obtained
a)&prec[2]
b)prec+2
d)*(prec+2)
floatfnum[10];
a)p=0;
b)p=255864u
c)p=&x
d)*p=10
float fnum[10],*fptr=fnum;
a)fnum+4
b)fnum[4]
c)fnum=++fptr
d)&fnum[4]
#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int (*function_pointer)(int, int, int);
function_pointer = mul;
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4));
}
Answer:a
#include <stdio.h>
int mul(int a, int b, int c)
{
return a * b * c;
}
void main()
{
int (function_pointer)(int, int, int);
function_pointer = mul;
printf("The product of three numbers is:%d",
function_pointer(2, 3, 4));
}
Answer:b
53. What is the output of this C code?
#include <stdio.h>
void f(int (*x)(int));
int myfoo(int);
int (*fooptr)(int);
int ((*foo(int)))(int);
int main()
{
fooptr = foo(0);
fooptr(10);
}
int ((*foo(int i)))(int)
{
return myfoo;
}
int myfoo(int i)
{
printf("%d\n", i + 1);
}
a) 10
b) 11
c) Compile time error
d) Undefined behaviour
Answer:b
Answer:b
55. Which of the following does not initialize ptr to null (assuming variable declaration of a as
int a=0;?
a) int *ptr = &a;
b) int *ptr = &a – &a;
c) int *ptr = a – a;
d) All of the mentioned
Answer:a
#include <stdio.h>
int x = 0;
void main()
{
int *ptr = &x;
printf("%p\n", ptr);
x++;
printf("%p\n ", ptr);
}
a) Same address
b) Different address
c) Compile time error
d) Varies
Answer:a
#include <stdio.h>
int x = 0;
void main()
{
int *const ptr = &x;
printf("%p\n", ptr);
ptr++;
printf("%p\n ", ptr);
}
a) 0 1
b) Compile time error
c) 0xbfd605e8 0xbfd605ec
d) 0xbfd605e8 0xbfd605e8
Answer:b
58. What is the output of this C code?
#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &x;
printf("%p\n", ptr);
ptr++;
printf("%p\n ", ptr);
}
a) 0xbfd605e8 0xbfd605ec
b) 0xbfd605e8 0cbfd60520
c) 0xbfd605e8 0xbfd605e9
d) Run time error
Answer:a
#include <stdio.h>
void main()
{
int x = 0;
int *ptr = &5;
printf("%p\n", ptr);
}
a) 5
b) Address of 5
c) Nothing
d) Compile time error
Answer:d
#include <stdio.h>
void main()
{
int k = 5;
int *p = &k;
int **m = &p;
**m = 6;
printf("%d\n", k);
}
a) 5
b) Compile time error
c) 6
d) Junk
Answer:c
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}
a) 1
b) Compile time error
c) Address of a
d) Junk value
Answer:b
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p %p", *r, a);
}
Answer:c
63. How many number of pointer (*) does C have against a pointer variable declaration?
a) 7
b) 127
c) 255
d) No limits.
Answer:d
#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;
int **sptr = &ptr1; //-Ref
*sptr = ptr2;
}
a) ptr1 points to a
b) ptr1 points to b
c) sptr points to ptr2
d) None of the mentioned
Answer:b
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int **r = &p;
printf("%p %p", *r, a);
}
a) Different address is printed
b) 1 2
c) Same address is printed.
d) 1 1
Answer:c
66. What substitution should be made to //-Ref such that ptr1 points to variable C?
#include <stdio.h>
int main()
{
int a = 1, b = 2, c = 3;
int *ptr1 = &a;
int **sptr = &ptr1;
//-Ref
}
a) *sptr = &c;
b) **sptr = &c;
c) *ptr1 = &c;
d) None of the mentioned.
Answer:a
Answer:d
#include <stdio.h>
int main()
{
int a = 10;
int **c -= &&a;
}
Answer:b
#include <stdio.h>
void main()
{
int a[3] = {1, 2, 3};
int *p = a;
int *r = &p;
printf("%d", (**r));
}
a) 1
b) Compile time error
c) Address of a
d) Junk value
Answer:b
#include <stdio.h>
int main()
{
char *str = "This" //Line 1
char *ptr = "Program\n"; //Line 2
str = ptr; //Line 3
printf("%s, %s\n", str, ptr); //Line 4
}
Answer:b
71. What type initialization is needed for the segment “ptr[3] = ’3′;” to work?
a) char *ptr = “Hello!”;
b) char ptr[] = “Hello!”;
c) Both (a) and (b)
d) None of the mentioned
Answer:b
73. The syntax for constant pointer to address (i.e., fixed pointer address) is:
#include <stdio.h>
int add(int a, int b)
{
return a + b;
}
int main()
{
int (*fn_ptr)(int, int);
fn_ptr = add;
printf("The sum of two numbers is: %d", (int)fn_ptr(2, 3));
}
Answer:d
75. The correct way to declare and assign a function pointer is done by:
(Assuming the function to be assigned is “int multi(int, int);”)
a) int (*fn_ptr)(int, int) = multi;
b) int *fn_ptr(int, int) = multi;
c) int *fn_ptr(int, int) = &multi;
d) Both (b) & (c)
Answer:a
76. Calling a function f with a an array variable a[3] where a is an array, is equivalent to
a) f(a[3])
b) f(*(a + 3))
c) f(3[a])
d) All of the mentioned
Answer:d
#include <stdio.h>
void f(char *k)
{
k++;
k[2] = 'm';
}
void main()
{
char s[] = "hello";
f(s);
printf("%c\n", *s);
}
a) h
b) e
c) m
d) o;
Answer:a
Answer:a
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
s->c = "hello";
printf("%s", s->c);
}
a) hello
b) Run time error
c) Nothing
d) Depends on compiler
Answer:a
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student *s;
s->c = "hello";
printf("%s", s->c);
}
a) hello
b) Segmentation fault
c) Run time error
d) Nothing
Answer:b
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
s->c = "hello";
printf("%s", m.c);
}
Answer:c
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student m;
struct student *s = &m;
(*s).c = "hello";
printf("%s", m.c);
}
Answer:d
#include <stdio.h>
struct student
{
char *c;
};
void main()
{
struct student n;
struct student *s = &n;
(*s).c = "hello";
printf("%p\n%p\n", s, &n);
}
a) Different address
b) Run time error
c) Nothing
d) Same address
Answer:d
#include <stdio.h>
struct p
{
int x[2];
};
struct q
{
int *x;
};
int main()
{
struct p p1 = {1, 2};
struct q *ptr1;
ptr1->x = (struct q*)&p1.x;
printf("%d\n", ptr1->x[1]);
}
Answer:b
#include <stdio.h>
struct p
{
int x[2];
};
struct q
{
int *x;
};
int main()
{
struct p p1 = {1, 2};
struct q *ptr1 = (struct q*)&p1;
ptr1->x = (struct q*)&p1.x;
printf("%d\n", ptr1->x[0]);
}
Answer:b
88. What is the output of this C code?
#include <stdio.h>
struct p
{
int x;
int y;
};
int main()
{
struct p p1[] = {1, 2, 3, 4, 5, 6};
struct p *ptr1 = p1;
printf("%d %d\n", ptr1->x, (ptr1 + 2)->x);
}
a) 1 5
b) 1 3
c) Compile time error
d) 1 4
Answer:a
#include <stdio.h>
struct p
{
int x;
char y;
};
int main(){
struct p p1[] = {1, 92, 3, 94, 5, 96};
struct p *ptr1 = p1;
int x = (sizeof(p1) / sizeof(struct p));
printf("%d %d\n", ptr1->x, (ptr1 + x - 1)->x);
}
Answer:d
91. What is the output of this C code (considering sizeof char is 1 and pointer is 4)?
#include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"};
printf("%d", sizeof(a));
return 0;
}
a) 9
b) 4
c) 8
d) 10
Answer:c
#include <stdio.h>
int main()
{
char a[2][6] = {"hello", "hi"};
printf("%d", sizeof(a));
return 0;
}
a) 9
b) 12
c) 8
d) 10
Answer:b
#include <stdio.h>
int main()
{
char a[2][6] = {"hello", "hi"};
printf("%s", *a + 1);
return 0;
}
a) hello
b) hi
c) ello
d) ello hi
Answer:c
#include <stdio.h>
int main()
{
char *a[2] = {"hello", "hi"};
printf("%s", *(a + 1));
return 0;
}
a) hello
b) ello
c) hi
d) ello hi
Answer:c
Answer:d
Answer:c
Answer:d
Answer:b
Answer:a
Answer:d
Answer:c
103. What would be the output if we try to execute following segment of code (assuming the
following input “cool brother in city”)?
printf(“%s\n”, argv[argc]);
a) (null)
b) City
c) In
D. Segmentation Fault
Answer:a
Answer:b
Answer:a
JSPM's
Jayawantrao sawant College of EngineeringHadpsar, Pune-33
Department of Information Technology
Multiple Choice Questions
Unit-3
12. The indirect change of the values of a variable in one module by another module is called
a. internal change
b. inter-module change
c. side effect
d. side-module update
13. Which of the following data structure is not linear data structure?
a. Arrays
b. Linked lists
c. Both of above
d. None of above
16. Finding the location of the element with a given value is:
a. Traversal
b. Search
c. Sort
d. None of above
19. Each array declaration need not give, implicitly or explicitly, the information about
a. the name of array
b. the data type of array
c. the first data from the set to be stored
d. the index set of the array
20. The elements of an array are stored successively in memory cells because
a. by this way computer can keep track only the address of the first element and the
addresses of other elements can be calculated
b. the architecture of computer memory does not allow arrays to store other than serially
c. both of above
d. none of above
21. When determining the efficiency of algorithm, the space factor is measured by
a. Counting the maximum memory needed by the algorithm
b. Counting the minimum memory needed by the algorithm
c. Counting the average memory needed by the algorithm
d. Counting the maximum disk space needed by the algorithm
24. If the values of a variable in one module is indirectly changed by another module, this
situation is called
a. internal change
b. inter-module change
c. side effect
d. side-module update
25. In linear search algorithm the Worst case occurs when
a. The item is somewhere in the middle of the array
b. The item is not in the array at all
c. The item is the last element in the array
d. The item is the last element in the array or is not there at all
29. When determining the efficiency of algorithm the time factor is measured by
a. Counting microseconds
b. Counting the number of key operations
c. Counting the number of statements
d. Counting the kilobytes of algorithm
31. The elements of an array are stored successively in memory cells because
a. by this way computer can keep track only the address of the first element and the
addresses of other elements can be calculated
b. the architecture of computer memory does not allow arrays to store other than serially
c. both of above
d. none of above
32. Which of the following data structure is not linear data structure?
a. Arrays
b. Linked lists
c. Both of above
d. None of above
35. Finding the location of the element with a given value is:
a. Traversal
b. Search
c. Sort
d. None of above
36. Which of the following case does not exist in complexity theory
a. Best case
b. Worst case
c. Average case
d. Null case
39. Each array declaration need not give, implicitly or explicitly, the information about
a. the name of array
b. the data type of array
c. the first data from the set to be stored
d. the index set of the array
40. The complexity of Binary search algorithm is
a. O(n)
b. O(log )
c. O(n2)
d. O(n log n)
43. The logical or mathematical model of a particular organization of data is called a .........
A) Data structure
B) Data arrangement
C) Data configuration
D) Data formation
48. Each node in a linked list has two pairs of .............. and ...................
A) Link field and information field
B) Link field and avail field
C) Avail field and information field
D) Address field and link field
49. A ........................ does not keep track of address of every element in the list.
A) Stack
B) String
C) Linear array
D) Queue
Unit-4
3.A characteristic of the data that binary search uses but the linear search ignores is
the___________
A.Order of the elements of the list
B.Length of the list
C.Maximum value in list
D.Type of elements of the list
ANSWER: A
5.For a linear search in an array of n elements the time complexity for best, worst and average
case are ......., ....... and ........ respectively
A.O(n), O(1), and O(n/2)
B.O(1), O(n) and O(n/2)
C.O(1),O(n) and O(n)
D.O(1), O(n) and (n-1/2)
ANSWER: C
6.Which of the following is false ?
A.A serial search begins with the first array element
B.A serial search continues searching, element by element, either until a match is found or until
the end of the array is encountered
C.A serial search is useful when the amount of data that must be search is small
D.For a serial search to work, the data in the array must be arranged in either alphabetical or
numerical order
ANSWER: D
7.The average successful search time for sequential search on 'n' items is
A.n/2
B.(n-1)/2
C.(n+1)/2
D.log (n)+1
ANSWER: C
8.A search begins the search with the element that is located in the middle of the array
A.serial
B.random
C.parallel
D.binary
ANSWER: D
9.Suppose DATA array contains 1000000 elements. Using the binary search algorithm, one
requires only about n comparisons to find the location of an item in the DATA array, then n is
A.60
B.45
C.20
D.None of these
ANSWER: C
14.A sort which compares adjacent elements in a list and switches where necessary is
A.insertion sort
B.heap sort
C.quick sort
D.bubble sort
ANSWER: D
15.Which of the following sorting methods would be most suitable for sorting a list which is
almost sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: A
17.The number of swappings needed to sort the numbers 8, 22, 7, 9, 31, 19, 5, 13 in ascending
order, using bubble sort is
A.11
B.12
C.13
D.14
ANSWER: D
18.A machine took 200 sec to sort 200 names, using bubble sort. In 800 sec, it can approximately
sort
A.400 names
B.800 names
C.750 names
D.800 names
ANSWER: A
19.Given a file of size n the number of times a given file is passed through in bubble sort is
A.n2
B.n - 1
C.n log n
ANSWER: B
20.In bubble sort, for a file of size n, after p iterations number of records in proper positions is
A.n - p
B.n - p + 1
C.p
ANSWER: A
21.A sort which iteratively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.insertion sort
B.selection sort
C.heap sort
D.quick sort
ANSWER: B
22.Which of the following sorting methods will be the best if number of swappings done, is the
only measure of efficienty?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Quick sort
ANSWER: B
23.What is the number of swaps required to sort n elements using selection sort, in the worst
case?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: A
26.For sorting a file of size n by straight selection sort, the number of comparisons made in the
first pass is
a.n
b.n - 1
c.n(n - 1)/2
ANSWER: B
28.You have to sort a list L consisting of a sorted list followed by a few “random”
elements.Which of the following sorting methods would be especially suitable for such a task?
A.Bubble sort
B.Selection sort
C.Quick sort
D.Insertion sort
Ans:D
29.Which of the following sorting methods would be most suitable for sorting a list which is
already sorted
A.Bubble Sort
B.Insertion Sort
C.Selection Sort
C.Quick Sort
ANSWER: B
30.The way a card game player arranges his cards as he picks them up one by one, is an example
of
A.bubble sort
B.Selection sort
C.insertion sort
D.merge sort
ANSWER: C
31.You want to check whether a given set of items is sorted. Which of the following sorting
methods will be most efficient if it is already in sorted order?
A.Bubble sort
B.Selection sort
C.Insertion sort
D.Merge Sort
ANSWER: C
32.Which of the following sorting algorithms does not have a worst case running time of O(n2)?
A.Insertion sort
B.Merge sort
C.Quick sort
D.Bubble sort
ANSWER: B
34.Assume 5 buffer pages are available to sort a file of 105 pages. The cost of sorting using m-
way merge sort is
A.206
B.618
C.840
D.926
ANSWER: C
37.A sort which relatively passes through a list to exchange the first element with any element
less than it and then repeats with a new first element is called
A.Insertion sort
B.Selection sort
C.Heap sort
D.Quick sort
ANSWER: D
40.Which of the following sorting methods sorts a given set of items that is already in sorted
order or in reverse sorted order with equal speed?
A.Heap sort
B.Quick sort
C.Insertion sort
D.Selection sort
ANSWER: B
41.A machine needs a minimum of 100 sec to sort 1000 names by quick sort. The minimum time
needed to sort 100 names will be approximately
A.50.2 sec
B.6.7 sec
C.72.7 sec
D.11.2 sec
ANSWER: B
43.In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an
T(n) time algorithm. What is the worst case time complexity of the quick sort?
A.T(n)
B.T(n log n)
C.T(n2)
D.T(n2 log n)
ANSWER: B
44.The running time of the following sorting algorithm depends on whether the partitioning is
balanced or unbalanced
A.Insertion sort
B.Selection sort
C.Quick sort
D.Merge sort
ANSWER: C
46.In quick sort, the number of partitions into which the file of size n is divided by a selected
record is
A.n
B.n - 1
C.2
ANSWER: C
47.The total number of comparisons made in quick sort for sorting a file of size n, is
a.O(n log n)
b.O(n2)
c.n(log n)
ANSWER: A
51.A sorting technique that guarantees that records with the same primary key occurs in the same
order in the sorted list as in the original unsorted list is said to be
A.stable
B.consistent
C.External
D.linear
ANSWER: A
UNIT-1
Marks distribution for Unit 1
4 + 4+ 2 +2 +1 = 13 Marks (Only 2 Question will be asked for 4 marks , 2 Questions will be asked for 2 Marks,
1 Question will be asked for 1 Mark )
Syllabus for Unit-1
Id 2
Question Numeric data include...........
A Double and Float
B integers and real numbers
Id 3
Question Range for Positive & Negative Integers numbers are.......
A 4,792 or -637
B 5,297 or -376
C 9724 or -367
D 3,297 or -376
Answer B
Marks 2
Page 1
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 4
Question structure chart Or interactivity chart Shows -----------------
A input, the processing, and the output;
B a beginning analysis of the problem
C overall layout or structure of the solution;
D a language like solution
Answer C
Marks 2
Unit 1
Id 5
Question IPO chart, shows -----------------
A a language like solution
B a beginning analysis of the problem
C overall layout or structure of the solution;
D input, the processing, and the output;
Answer Correct Option D
Marks 2
Unit 1
Id 6
Question pseudo code shows --------------
A input, the processing, and the output;
B a beginning analysis of the problem
C overall layout or structure of the solution;
D a language like solution
Answer Correct Option D
Marks 2
Unit 1
Id 7
Question ---------------shows the relationship between the modules and the data needed for the
modules.
A coupling diagram and Data Dictionary
B IPO chart
C interactivity chart
D pseudo code
Answer Correct Option A
Marks 2
Unit 1
Page 2
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 8
Question Identify the correct sequence of problem analysis chart.
A 1)Given Data, 2)Solution Alternatives,3)Processing Required , 4)Required Results
B 1) Given Data, 2) Required Results , 3) Processing Required , 4)Solution Alternatives
C 1)Processing Required, 2) Required Results , 3)Given Data, 4)Solution Alternatives
D 1) Given Data, 2) Required Results , 3) Solution Alternatives, 4)Processing Required
Answer Correct Option B
Marks 2
Unit 1
Id 9
Question In interactivity chart Dark circle • on module link shows
A module is part of a set but that are not processed many times
B module is not a part of set that are processed many times & in a loop.
C module is part of a set that are processed many times & in a loop.
D None of these
Answer Correct Option C
Marks 2
Unit 1
Id 13
Question arrange the essential data items for IPO Chart in correct order
A 1)Output 2)Processing 3)Module Reference 4)Input
B 1)Input 2)Module 3) Processing Reference 4)Output
C 1)Input 2)Processing 3)Module Reference 4)Output
D None of these
Answer Correct Option C
Marks 4
Unit 1
Id Keep it blank
Id 10
Question If max is a function that returns the larger of the two integers, given as arguments,
then which of the following statements finds the largest of three given numbers
A max(max(a,b),max (a,c))
B max(max(a,b),max (b,c))
C max(b,max (a,c))
D All of these
Answer Correct Option D
Marks 4
Page 3
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 11
Question A function can make…………..
A One throw
B One throw of each scale type
C One throw of each programmer defined type
D As many throws of as many types as necessary
Answer Correct Option D
Marks 2
Unit 1
Id 12
Question Consider the function
find ( int x, int y)
{
return (( x < y ) ? 0 : ( x - y ));
}
Let a, b be two non-negative integers.
The call find{ a, find(a, b)} can be used to find the
A maximum of a,b
B positive difference of a,b
C sum of a,b
D minimum of a,b
Answer Correct Option D
Marks 4
Unit 1
Id 13
Question Let a, b be two non-negative integers. Which of the following calls, finds the positive
difference of a and b ?
A find(a,b) + find(b,a)
B find(a, find(a,b))
C a + find(a,b)
D b + find(a,b)
Answer Correct Option A
Marks 4
Unit 1
Id 14
Question The default parameter passing mechanism is
A call by value
Page 4
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
B call by reference
C call by value result
D none of the above
Answer Correct Option A
Marks 2
Unit 1
Id 15
Question Use of functions
A helps to avoid repeating a set of statements many times
B enhances the logical clarity of the program
C helps to avoid repeated programming across programs
D all of the above
Answer Correct Option D
Marks 2
Unit 1
Id 15
Question Pick the correct statements
A The body of a function should have only one return statement
B The body of a function may have many return statements
C A function can return only one value to the calling environment
D Both (b) and (c )
Answer Correct Option D
Marks 2
Unit 1
Id 16
Question Forward declaration is absolutely necessary
A if a function returns a non integer quantity
B lithe function call precedes its definition
C if the function call precedes its definition and the function returns a non integer
quantity
D none of the above
Answer Correct Option C
Marks 2
Unit 1
Id 17
Question void can be used…………
A as a data type of a function that returns nothing to its calling environment
Page 5
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
B inside the brackets of a function that does not need any argument
C in an expression
D Both (a) and (b)
Answer Correct Option D
Marks 2
Unit 1
Id 18
Question Any C++ program
A must contain at least one function
B need not contain any function
C needs input data
D none of these
Answer Correct Option A
Marks 1
Unit 1
Id 19
Question In a certain language, the expression 5-3+2 x 4+1, evaluates to 0. Which of the
following conclusions about the precedence and associativity of the operators +, -, *
are correct?
A + has precedence over - and - has precedence over *
B All these have equal precedence and associate to the right
C All these have equal precedence and associate to the left
D + and – have equal precedence, which is over * and all associate to the left
Answer A
Marks 2
Unit 1
Id 20
Question Which of the following comparison between static and dynamic type checking is
Incorrect?
A Dynamic type checking slows down execution
B Dynamic type checking offers more flexibility to the programmers
C Dynamic type checking is more reliable
D Dynamic type checking is done during compilation, unlike static type checking
Answer A
Marks 2
Unit 1
Id 21
Page 6
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Question The period of time between an allocation and its subsequent disposal is called
A Scope
B (dynamic) binding
C Lifetime
D Longevity
Answer C
Marks 2
Unit 1
Id 22
Question Consider the following sequence of statements
Statement 1: A := B+C
Statement 2: D := A+C
Statement 3: E := A+B
Statement 4: G := D-E
Statement 5: H := E+A
Statement 6: I := H+G
Which of the statements can be executed in parallel?
A 2 and 4
B 4 and 5
C 5 and 6
D 4, 5 and 6
Answer A
Marks 2
Unit 1
Id 23
Question If instructions are executed in parallel, whenever the required operands are
available, then the execution time of the previous problem is logically same as that of
sequential algorithm consisting of
A 3 statements
B 2 statements
C 4 statements
D 5 statements
Answer C
Marks 2
Unit 1
Id 24
Question
A recursive function f(x), is defined as follows:
if(x>100)
return(x-10)
else return(f(f(x+11)))
For which of the values of x, f(x) = 91?
Page 7
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
A 100
B 91
C 1
D 101
Answer A
Marks 2
Unit 1
Id 25
Question English language uses full stop as a sentence, while C++ uses ……….
A Separator
B Terminator
C Delimiter
D All of the above
Answer B
Marks 2
Unit 1
Id 26
Question The ASCII (American Standard Code for Information Interchange) character set
contains ------------- characters.
A 652
B 562
C 256
D 265
Answer C
Marks 2
Unit 1
Id 27
Question The character data set, sometimes called alphanumeric data set, consists of all------
A a, A
B A, Z
C #, &
D a, A, Z, 3, #, &
Answer D
Marks 2
Unit 1
Id 33
Question Character data or string data can be joined together with the + operator in an
Page 8
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
operation called-----------
A Palindrome
B Join
C Reverse String
D concatenation
Answer D
Marks 1
Unit 1
Id 34
Question When two pieces of character data are joined, the concatenation results in “4” + “4”
= ? (Replace? With suitable option)
A “44”
B 8
C “8”
D 4+4
Answer A
Marks 2
Unit 1
Id 35
Question Identify the data type for following data set : The price of an Item: 7.39, 12.98
A Numeric: real
B Character string
C Numeric: integer
D Logical
Answer A
Marks 1
Unit 1
Id 36
Question Identify the data type for following data set : An account number: “A2453,” “2987”
A Numeric: real
B Character string
C Numeric: integer
D Logical
Answer B
Marks 2
Unit 1
Id 37
Page 9
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Question Identify the data type for following data set :A quantity:12389
A Numeric: real
B Numeric: integer
C Reverse String
D Logical
Answer B
Marks 1
Unit 1
Id 38
Question Identify the data type for following data set :A credit check: True, False
A Numeric: real
B Numeric: integer
C Logical
D Character string
Answer C
Marks 1
Unit 1
Id 39
Question Choose the correct syntax for defining the function
A Function(Data);
B DefineFunction(value)
C FunctionName(Value)
D FunctionName(Value)
Answer C
Marks 1
Unit 1
Id 40
Question Absolute value, or a random number are belongs to which function type?
A Mathematical functions
B String functions.
C Conversion functions.
D Statistical functions.
Answer A
Marks 1
Unit 1
Id 41
Page 10
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 42
Question The recurrence relation that arises in relation with the complexity of binary search
is
A T(n)=T(n/2)+k, where k is constant
B T(n)=2T(n/2)+k, where k is constant
C T(n)=T(n/2)+log(n)
D T(n)=T(n/2)+n
Answer Correct option A
Marks 1
Unit 1
Id 43
Question Which of the following algorithm design technique is used in the quick sort
algorithm
A Dynamic programming
B Backtracking
C Divide & conquer
D Greedy method
Answer Correct option C
Marks 1
Unit 1
Id 44
Question Literal means
A a string
B a string constant
C a character
D an alphabet
Answer Correct Option B
Marks 2
Unit Unit 1
Page 11
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 45
Question The value of an automatic variable that is declared but not initialized will be
A 0
B -1
C unpredictable(garbage value)
D none of these
Answer Correct Option C
Marks 2
Unit Unit 1
Id 46
Question Which of the following is true of external variables?
A they provide a way for two way communication between functions
B their scope extends from the point of definition through the remainder of the
program
C if they are not initialized, they will be initilised to zero
D All of these
Answer Correct Option D
Marks 2
Unit Unit 1
Id 47
Question The declaration
int x : 4;
means
A x is a four digit integer
B x cannot be greater than a four digit integer
C x is a four-bit integer
D none of these
Answer Correct Option C
Marks 4
Unit Unit 1
Id 48
Question What is the correct way to round off x from a float, to an int value?
A y=(int) (x+0.5)
B y=int (x+0.5)
C y=(int) x+0.5
D y=(int)(int) x+0.50
Answer Correct Option A
Marks 4
Unit Unit 1
Page 12
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id Keep it blank
Question By default, any real number in 'C' is treated as ……..
A A float
B A double
C A long double
D Depends on the memory model you are using
Answer Correct Option B
Marks 2
Unit Unit 1
Id 49
Question To print out a and b given below, which printf() statement would you use?
float a = 3.14;
double b = 3.14;
A printf("%f%f",a,b);
B printf("%Lf%f",a,b);
C printf("%f%Lf",a,b);
D printf("%Lf%Lf",a,b);
Answer Correct Option A
Marks 4
Unit Unit 1
Id 50
Question In the following 'C' code, in which order the functions would be called ?
a = ( f1(23,14 ) * f2 (12/14)) + f3 () ;
A f1,f2,f3
B f3,f2,f1
C The order may vary from compiler to compiler
D None of these
Answer Correct Option A
Marks 4
Unit Unit 1
Id 51
Question Which one of the following is not the step in ensuring best decision
A Identify the problem.
B Understand the problem.
C Discard the problem & solution
D Evaluate the solution.
Answer C
Marks 2
Page 13
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 52
Question Solutions that cannot be reached through a direct set of steps are called..........
A algorithmic solutions.
B alternative Solution
C heuristic solutions.
D straightforward Solution
Answer C
Marks 2
Unit 1
Id 53
Question A problem that can be solved with a series of actions is called............
A Heuristic solutions.
B Algorithmic solutions.
C straightforward Solution
D alternative Solution
Answer B
Marks 2
Unit 1
Id 54
Question A heuristic type of problems is called..........
A Operation Research
B Artificial intelligence
C Fuzzy Logic
D None of these
Answer B
Marks 2
Unit 1
Id 55
Question The.................... steps in problem solving lead to the best possible solution to a
problem.
A Six
B Four
C Five
D Seven
Answer A
Marks 1
Page 14
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 56
Question The..................solutions are reached in a series of steps.
A algorithmic solutions
B heuristic solutions
C Artificial intelligence
D straightforward Solution
Answer A
Marks 1
Unit 1
Id 57
Question The...................... solutions are attained through trial and error.
A straightforward Solution
B alternative Solution
C algorithmic solutions.
D heuristic solutions.
Answer D
Marks 1
Unit 1
Id 58
The programmer defines each .............and ............... in a problem solution as a
Question particular data type
A Pointer , Array
B Integer , Double
C String , Float
D constant , variable
Answer D
Marks 1
Unit 1
Id 59
Question Variable also known as .....
A Font
B Constant
C Identifier
D File
Answer C
Marks 1
Page 15
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 60
Question A constant is a value that never changes during the processing of all the instructions
in a solution
A FALSE
B None of these
C TRUE
D Both A &C
Answer D
Marks 1
Unit 1
Id 61
Question In UML Sequence diagram used to indicate----------
Id 62
Question In UML Use case diagrams Used to indicate----------
A how a system functions from the user‟s standpoint
B to create a logical model of your solution
C describe how a class functions
D interactivity between objects
Answer A
Marks 2
Unit 1
Id 63
Question In UML Class diagrams Used to indicate----------
A describe how a class functions
B how a system functions from the user‟s standpoint
C to create a logical model of your solution
D interactivity between objects
Answer A
Marks 2
Page 16
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 64
Question Two main measures for the efficiency of an algorithm are
A Processor and memory
B Complexity and Capacity
C Time and Space
D Data and Space
Answer C
Marks 2
Unit 1
Id 65
Question The time factor while determining the efficiency of algorithm is measured by
A Counting microseconds
B Counting the number of key operations
C Counting the number of statements
D Counting the kilobytes of algorithm
Answer B
Marks 2
Unit 1
Id 66
Question The worst case occur in linear search algorithm when
A Item is somewhere in the middle of the array
B Item is not in the array at all
C Item is the last element in the array
D Item is the last element in the array or is not there at all
Answer D
Marks 2
Unit 1
Id 67
Question In case of ordinary int variables
A leftmost bit is reserved for sign
B rightmost bit is reserved for sign
C no bit is reserved for sign
D none of these
Answer A
Marks 2
Page 17
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 68
Question The variables which can be accessed by all modules in a program are known as
A Local variables
B Internal variables
C External variables
D Global variables
Answer Correct Option (D)
Marks 2
Unit 1
ID 69
Question The basic unit of information is the
A Byte
B Bit
C Block
D Sector
Answer B
Marks 2
Unit 1
ID 70
Question The most widely used method for interpreting bit setting as nonnegative integer is
the
A Octal number system
B ASCII
C ANS!
D Binary number system
Answer D
Marks 2
Unit 1
ID 71
Question The method used by the computers to represent real number is
A Floating-point notation
B Mantissa
C ANSI
D Binary number system
Answer D
Marks 2
Page 18
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
ID 72
Question The variable which can be accessed by all modules in a program, are known as
A Local variable
B Internal variable
C External variable
D Global variable
Answer D
Marks 2
Unit 1
ID 73
Question In which kind of storage structure for string , one can easily insert ,delete,
concatenate ,and rearrange substring?
A Fixed length storage structure
B Variable length storage structure
C Linked list storage
D Array type storage
Answer C
Marks 2
Unit 1
ID 74
Question Which of the following sorting procedure is the slowest ?
A Quick sort
B Heap sort
C Shell sort
D Bubble sort
Answer B
Marks 2
Unit 1
ID 75
Question The smallest element of an array‟s index is called its
A Lower bound
B Upper bound
C Range
D Extraction
Answer A
Page 19
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Marks 2
Unit 1
ID 76
Question The preliminary evaluation of a top-down design before programs are written is
referred to as a (an)
A Informal design review
B Structured walk through
C formal design review
D Scheduled review
Answer A
Marks 2
Unit 1
ID 77
Question Which of the following is not an example of program documentation
A Source code
B Object code
C Specification
D Identifier names
Answer B
Marks 1
Unit 2
ID 78
Question Which of the following is non-essential to stepwise refinement?
I. Refining the subprogram
II. Decomposing the problem into subprograms
III. Declaring all variables
IV. Stating the problem simply
V. Inputing the data
A 2
B 3 and 4
C 4 and 5
D 5
Answer D
Marks 4
Unit 1
ID 79
Question A top-down approach to programming calls for
1. Working from the general to the specific
Page 20
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
A 1
B 1 and 2
C 1,2 and 3
D 1,2 and 4
Answer C
Marks 4
Unit 1
ID 80
Question Repeated execution of simple computation of
A Round-off errors
B Syntax errors
C Run-time errors
D Logic errors
Answer A
Marks 2
Unit 1
ID 81
Question Which of the following boolean expression is true?
A 2*2+3=10
B (2.4)and not(4.3)
C (5.6)or(3 div 3 = 1)
D -7 * 2 + 2 * 7 = 1
Answer C
Marks 2
Unit 1
id 82
Question In C++ programming language, which of the following type of operators have the
highest precedence
A Relation operators
B Equality operators
C Logical operators
D Arithmetic operators
Answer D
Marks 2
Unit 1
Page 21
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
196 83
Question In C++ programming language, which of the following operators has the highest
precedence
A Unary +
B *
C ≥
D ==
Answer A
Marks 2
Unit 1
197 84
In C++ programming language, if the first and the second operands of operator + are
Question of types int and float,respectively,the result will be of type
A int
B float
C char
D Long int
Answer B
Marks 2
Unit 1
199 85
Question In C++ language, the bitwise operators can be applied to which of the following
operands
A char
B Short,long
C Int
D All of the above
Answer D
Marks 2
Unit 1
Id 86
Question Consider the n elements are to be sorted. what is the worst case time complexity of
20 bubble sort?
A O(1)
B O(log2 n)
C O(n)
2
D O(n )
Answer Correct Option (D)
Page 22
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Marks 4
Unit 1
Id 87
Question Consider that n elements are to be sorted. What is the worst case time complexity of
21 shell sort?
A O(n)
B O(n log2 n)
C O(n1.2)
D O(n)
Id 88
Question What is the worst case time Complexity of straight insertion sort algorithm to sort n
22 elements
A O (n)
B O (n Log2 n)
C O(n1.2)
D O(n2)
Answer Correct Option(D)
Marks 4
Unit 1
Id 89
Question What is the worst space time complexity of binary insertion sort algorithm to sort n
23 elements
A O(n)
B O(n log2 n)
C O(n1.2)
D O(n2)
Answer Correct Option (D)
Marks 4
Unit 1
Id 90
Question 25 Which of the following sorting procedure in the slowest?
A Quick sort
B Heap sort
C Shell sort
Page 23
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
D Bubble sort
Answer Correct option (D)
Marks 2
Unit 1
Id 91
Question In a 'C++' expression involving || operator, evaluation
A Will be stopped if one of its components evaluates to false
B Will be stopped if one of its components evaluates to true
C Takes place from right to left
D Will be stopped if both of its components evaluates to true
Answer Correct Option B
Marks 2
Unit 1
Id 92
Question In C programming language, which of the following type of operators have the
highest precedence
A Relational Operators
B Equality Operators
C Logical Operators
D Arithmetic Operators
Answer Correct Option D
Marks 2
Unit 1
Id 93
Question In C programming language, which of the following operators has the highest
precedence?
A Unary +
B *
C >=
D Equals (==)
Answer Correct Option A
Marks 2
Unit 1
Id 94
Question Which of the following operators takes only integer operands ?
A +
B *
Page 24
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
C /
D %
Answer Correct Option D
Marks 2
Unit 1
Id 95
Question In an operation involving || operator, evaluation
A takes palce from left to right
B Will be stopped if one of its components evaluates to true
C Takes place from right to left
D Both (a) and (b)
Answer Correct Option D
Marks 2
Unit 1
Id 96
Question Pick the operators that associate from the left
A +
B ,
C <
D All the above
Answer Correct Option D
Marks 2
Unit 1
Id 97
Question The operators . , || , < , = , if arranged in the ascending order of precedence reads
A . , || , < , =
B (=, < , ||, .)
C (=, || , < , .)
D (< , || , = , .)
Answer Correct Option C
Marks 2
Unit 1
Id 98
Question The expression 4 + 6 / 3 * 2 - 2 + 7 % 3 evaluates to
A 3
B 5
Page 25
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
C 6
D 7
Answer Correct Option D
Marks 4
Unit 1
Id 99
Question Which of the following sorting algorithm is stable
A insertion sort.
B bubble sort.
C quick sort.
D heap sort.
Answer Correct Option D
Marks 2
Unit 1
Id 100
Question The number of elements that can be sorted in Θ(logn) time using heap sort is
A Θ(1)
B Θ(√logn)
C Θ(√logn)
D Θ(logn)
Answer Correct Option A
Marks 2
Unit 1
Id 101
Question A sort which relatively passes through a list to exchange the first element with any
element less than it and then repeats with a new first element is called
A Insertion sort
B Selection sort
C Heap sort
D Quick sort
Answer Correct Option D
Marks 2
Unit 1
Id 102
Question A sorting technique which uses the binary tree concept such that label of any node is
larger than all the labels in the subtrees, is called
A Selection sort
Page 26
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
B Insertion sort
C Insertion sort
D Quick sort
Answer Correct Option C
Marks 2
Unit 1
Id 103
Question A sort which uses binary tree concept such that any number is larger than all the
numbers in the subtree below it,is called
A Selection sort
B Insertion sort
C Heap sort
D Quick sort
Answer Correct Option C
Marks 2
Unit 1
Id 104
Question Which sorting algorithm uses the median-of-3 partitioning?
A heap sort
B merge sort
C quick sort
D Shell sort
Answer Correct Option
Marks 2
Unit 1
Id 105
Question Which data type is not a primary data type?
A int
B array
C float
D char
Answer Correct Option B
Marks 1
Unit 1
Id 106
Question How much memory is required to store a value of type double
A 4bytes
Page 27
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
B 6 bytes
C 8 bytes
D 10 bytes
Answer Correct Option C
Marks 1
Unit 1
Id 107
Question The modifier which is used to declare a variable as constant
A short
B signed
C unsigned
D const
Answer Correct Option D
Marks 1
Unit 1
Id 108
Question A declaration "short int" is used for variables
A which have a short duration in a program
B which have short names
C which may require less storage than normal integer
D all of these
Answer Correct Option C
Marks 1
Unit 1
Id 109
Question 5 The number of swapping needed to sort the number 8,12,7,9,31,19,5,13 in ascending
order, using bubble sort is
A 11
B 12
C 13
D 14
Answer D
Marks 4
Unit 1
Id 110
Question 6 Given 2 sorted list of size „m‟ and „n‟ respectively. The number of comparisons needed
in the worst case by the merge sort algorithm will be
Page 28
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
A mn
B max (m,n)
C min (m,n)
D M+n-1
Answer B
Marks 4
Unit 1
Id 111
A hash table with 10 buckets with one slot per bucket is depicted. The symbols, S1 to
Question 8 S7 are initially entered using a hashing function with linear probing. The maximum
number of comparisons needed in searching an item that is not present is
A 4
B 5
C 6
D 3
Answer B
Marks 4
Unit 1
Id 112
Question 9 A binary tree in which every non-leaf node has non-empty left and right sub-trees is
called a strictly binary tree. Such a tree with 10 leaves
A Cannot have more than 19 node
B Has exactly 19 nodes
C Has exactly 17 nodes
D Cannot have more than 17 nodes
Answer A
Marks 4
Unit 1
Id 113
Question 87 The variables which can be accessed by all modules in a program, are called
A local variables
B internal variables
C external variables
D global variable
Answer D
Marks 2
Unit 1
Page 29
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 114
Question 90 A static variable
A cannot be initialized
B is initialized once at the commencement of execution and cannot be changed at run
time
Id 115
Question 31 To find the length or the number of characters in the string, which function type you
will use?
A String Functions
B Mathematical functions.
C Conversion functions.
D Statistical functions.
Answer A
Marks 1
Unit 1
Id 116
Question 32 Match the Definitions from given options, for the function Sqrt(N)
A Returns the absolute value of N
B Returns the square root of N.
C Returns the rounded value of N to the n1 place.
D Returns a random number between 0 and 1
Answer B
Marks 2
Unit 1
Id Keep it blank
Question 33 Match the Definitions from given options, for the function Abs(N)
A Returns the square root of N.
B Returns the absolute value of N.
C Returns the rounded value of N to the n1 place.
D Returns a random number between 0 and 1
Answer B
Marks 2
Unit 1
Page 30
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO. .40
Id 117
Question 34 If we use function Integer (5.7269) then what will be the result it will return.
A 5.72
B 5.7269
C 5
D 5.7
Answer C
Marks 4
Unit 1
Id 118
Question 35 If we use function Abs (-3)then what will be the result it will return.
A -3
B -3
C 3
D A3.0
Answer C
Marks 4
Unit 1
Id 119
Question Replace blank space with suitable option :- ----------- are used to calculate things
such as maximum values, minimum values, and so forth..
A Statistical functions.
B Mathematical functions.
C String functions.
D Conversion functions
Answer A
Marks 1
Unit 1
Id 120
Question Select appropriate definition from given options for the function Value(S)
A Changes a string value into a numeric value.
B Changes a numeric value into a string value.
Page 31
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
DEPARTMENT OF COMPUTER ENGINEERING , MATOSHRI COLLEGE OF ENGINEERING & R.C. NASHIK , PAGE NO. .41
Id 121
Question Select appropriate definition from given options for the function String(N)
A Changes a string value into a numeric value.
B Changes a numeric value into a string value.
C Returns the average of a list of numbers.
D Returns the maximum value from a list of numbers..
Answer B
Marks 2
Unit 1
Id 122
Question Which of the following sorting algorithms does not have a worst case running time of
o(n2)
A Insertion sort
B Merge sort
C Quick sort
D Bubble sort
Answer Correct Option (B)
Marks 2
Unit 1
Id 123
Question Identify the operator & operand from given expression 5 + 7
A 5 and 7 are operator, + is the operand
B 5 is operator & 7 is operand
C + is the operator, 5 and 7 are the operand
D None of these
Answer C
Marks 1
Unit 1
Page 32
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 124
Question Calculate the resultant for the operation like 9 MOD 4
A 2
B 0.44
C 2.25
D 1
Answer D
Marks 2
Unit 1
Id 125
Question Choose the correct resultant for the logical operation like:- True AND True
A TRUE
B FALSE
C Both A&B
D None of these
Answer A
Marks 2
Unit 1
Id 126
Question Construct the expression for”a 40-hour work week and overtime pay at 1.5 times
regular pay, calculated overtime pay would subtract 40 from the hours worked and
multiply the result by the regular wage times 1.5”
A (Hours-40)*Wage*1.5
B (Wage-40)*Hours*1.5
C (Hours-1.5)*Wage*40
D (Overtime-40)*Regular Pay*1.5
Answer A
Marks 2
Unit 1
Id 127
Question --------------------refers to the rules governing the computer operating system, the
language, and the application.
A Bug.
B Syntax
C Debugging.
D Testing
Answer B
Marks 2
Page 33
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 128
Question Problem analysis chart shows -----------------
A input, the processing, and the output;
B overall layout or structure of the solution;
C a beginning analysis of the problem
D a language like solution
Answer C
Marks 1
Unit 1
Id 129
Question Which of the following case does not exist in complexity theory?
A Best case
B Worst case
C Average case
D Null case
Answer D
Marks 1
Unit 1
Id 130
Question The complexity of linear search algorithm is
A O(n)
B O(log n)
C O(n2)
D O(n log n)
Answer A
Marks 1
Unit 1
Id 131
Question The complexity of Binary search algorithm is
A O(n)
B O(log n)
C O(n2)
D O(n log n)
Answer B
Marks 1
Unit 1
Id 132
Question The complexity of merge sort algorithm is
A O(n)
B O(log n)
C O(n2)
Page 34
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
D O(n log n)
Answer D
Marks 1
Unit 1
Id 133
Question The complexity of Bubble sort algorithm is
A O(n)
B O(log n)
C O(n2)
D O(n log n)
Answer C
Marks 1
Unit 1
Id 134
Question The Worst case occur in linear search algorithm when
A Item is somewhere in the middle of the array
B Item is not in the array at all
C Item is the last element in the array
D Item is the last element in the array or is not there at all
Answer D
Marks 1
Unit 1
Id 135
Question The worst case complexity for insertion sort is
A O(n)
B O(log n)
C O(n2)
D O(n log n)
Answer C
Marks 1
Unit 1
Id 136
Question The complexity of Fibonacci series is
A O(2n)
B O(log n)
C O(n2)
D O(n log n)
Answer A
Marks 1
Unit 1
Id 137
Question If f(x) = 3x2 + x3logx, then f(x) is
A O(x2)
B O(x3)
Page 35
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
C O(x)
D O(1)
Answer B
Marks 1
Unit 1
Id 138
Question The big-O notation for f(n) = (nlogn + n2)(n3 + 2) is
A O(n2)
B O(3n)
C O(n4)
D O(n5)
Answer D
Marks 1
Unit 1
Id 139
Question The big-O notation for f(n) = 2log(n!) + (n2 + 1)logn is
A n
B n2
C nlogn
D n2logn
Answer D
Marks 1
Unit 1
Id 140
Question The big-theta notation for function f(n) = 2n3 + n – 1 is
A n
B n2
C n3
D n4
Answer C
Marks
Unit
Id 141
Question The big-theta notation for f(n) = nlog(n2 + 1) + n2logn is
A n2logn
B n2
C logn
D nlog(n2)
Answer A
Marks 1
Unit 1
Id 142
Question The big-omega notation for f(x, y) = x5y3 + x4y4 + x3y5 is
A x5y3
Page 36
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
B x5y5
C x3y3
D x4y4
Answer C
Marks 1
Unit 1
Id 143
Question If f1(x) is O(g(x)) and f2(x) is o(g(x)), then f1(x) + f2(x) is
A O(g(x))
B o(g(x))
C O(g(x)) + o(g(x))
D None of these
Answer A
Marks 1
Unit 1
Id 144
Question The big-O notation for f(x) = 5logx is
A 1
B X
C X2
D X3
Answer B
Marks 1
Unit 1
Id 145
Question Which if the following is/are the levels of implementation of data structure
A Abstract level
B Application level
C Implementation level
D All of the above
Answer D
Marks 1
Unit 1
Id 146
Question ……………….. level is where the model becomes compatible executable code
A Abstract level
B Application level
C Implementation level
D All of the above
Answer C
Marks 1
Unit 1
Id 147
Question Stack is also called as
Page 37
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 148
Which of the following is true about the characteristics of abstract data types?
i) It exports a type.
Question ii) It exports a set of operations
A True, False
B False, True
C True, True
D False, False
Answer C
Marks 1
Unit 1
Id 149
Question …………… is not the component of data structure.
A Operations
B Storage Structures
C Algorithms
D None of above
Answer D
Marks 1
Unit 1
Id 150
Question Which of the following is not the part of ADT description?
A Data
B Operations
C Both of the above
D None of the above
Answer D
Marks 1
Unit 1
Id 151
Inserting an item into the stack when stack is not full is called …………. Operation
and deletion of item form the stack, when stack is not empty is called
Question ………..operation.
A push, pop
B pop, push
C insert, delete
D delete, insert
Answer A
Marks 2
Page 38
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Unit 1
Id 152
……………. Is a pile in which items are added at one end and removed from the
Question other.
A Stack
B Queue
C List
D None of the above
Answer B
Marks 1
Unit 1
Id 153
………… is very useful in situation when data have to stored and then retrieved in
Question reverse order.
A Stack
B Queue
C List
D Link list
Answer A
Marks 1
Unit 1
Id 154
Question Which data structure allows deleting data elements from and inserting at rear?
A Stacks
B Queues
C Dequeues
D Binary search tree
Answer B
Marks 1
Unit 1
Id 155
Which of the following data structure can't store the non-homogeneous data
Question elements?
A Arrays
B Records
C Pointers
D Stacks
Answer A
Marks 1
Unit 1
Id 156
A ....... is a data structure that organizes data similar to a line in the supermarket,
Question where the first one in line is the first one out.
A Queue linked list
B Stacks linked list
Page 39
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
C Both of them
D Neither of them
Answer A
Marks 1
Unit 1
Id 157
Identify the data structure which allows deletions at both ends of the list but
Question insertion at only one end.
A Input-restricted deque
B Output-restricted deque
C Priority queues
D None of above
Answer A
Marks 1
Unit 1
Id 158
Question Which of the following data structure is non-linear type?
A Strings
B Lists
C Stacks
D None of above
Answer D
Marks 1
Unit 1
Id 159
Question Which of the following data structure is linear type?
A Strings
B Lists
C Queues
D All of above
Answer D
Marks 1
Unit 1
Id 160
To represent hierarchical relationship between elements, which data structure is
Question suitable?
A Deque
B Priority
C Tree
D All of above
Answer C
Marks 1
Unit 1
Id 161
Page 40
Data Structures & Algorithms M.C.Q. BANK, FOR UNIT -1 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN , U.O.P.
Id 162
Question A mathematical-model with a collection of operations defined on that model is called
A Data Structure
B Abstract Data Type
C Primitive Data Type
D Algorithm
Answer B
Marks 1
Unit 1
Page 41
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
UNIT-2
Marks distribution for Unit 2
4 + 4+ 2 +2 +1 = 13 Marks (Only 2 Question will be asked for 4 marks , 2 Questions will be asked for 2
Marks, 1 Question will be asked for 1 Mark )
Syllabus for Unit-2
Sequential Organization, Linear Data Structure Using Sequential Organization, Array as an Abstract
Data Type, Memory Representation and Address Calculation, Inserting an element into an array,
Deleting an element, Multidimensional Arrays, Two-dimensional arrays, n- dimensional arrays, Concept
of Ordered List, Single Variable Polynomial, Representation using arrays, Polynomial as array of
structure, Polynomial addition, Polynomial multiplication, Sparse Matrix, Sparse matrix representation,
Sparse matrix addition, Transpose of sparse matrix, String Manipulation Using Array.
Case Study- Use of sparse matrix in Social Networks and Maps.
Reference Book:
• “Data Structures Using C++”, Varsha H. Patil, ISBN 13-9780198066231
Id 1
What will happen if in a C++ program, you assign a value to an array element whose
Question subscript exceeds the size of array?
A The element will be set to 0.
B The compiler would report an error
C The program may crash if some important data gets overwritten.
D The array size would appropriately grow.
Answer C
Marks 2
Id 2
What does the following declaration mean?
Question int (*ptr)[10];
A ptr is array of pointers to 10 integers
B ptr is a pointer to an array of 10 integers
C ptr is an array of 10 integers
D ptr is an pointer to array
Answer B
Marks 2
Id 3
Question In C++, if you pass an array as an argument to a function, what actually gets passed?
A Value of elements in array
B First element of the array
C Base address of the array
D Address of the last element of array
Answer C
Marks 2
Id 4
What is meaning of following declaration ?
Question int arr[20];
Page 1
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
A None of these
B Integer Array of size 20
C Array of Size 20
D Array of size 20 that can have integer address
Answer B
Marks 2
Id 5
int a[20];
What will be the size of above array element ?
Question
A 20
B 19
C 22
D 21
Answer A
Marks 2
Id 6
Question What is meaning of the following statement? int *ptr[20];
A None of these
B Array of Integer Pointers of size 20
C Integer Array to Integer Pointers having size 20
D Integer Array of size 20 pointing to an Integer Pointer
Answer B
Marks 2
Id 7
Question In C++ Programming, If we need to store word "INDIA" then syntax is as below -
char name[]; name = "INDIA";
A
char name[6] = {'I','N','D','I','A'}
B
char name[6] = {"I","N","D","I","A"}
C
char name[6] = {'I','N','D','I','A','\0'}
D
Answer D
Marks 2
Id 8
int RollNum[30][4];
Above is an example of:
Question
A 2-D Array
B 1-D Array
C 3-D Array
D 4-D Array
Page 2
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Answer A
Marks 2
Id 9
What is the output of this C code?
#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
Question }
A 123450
B 1 2 3 4 5 junk
C 123455
D Run time error
Answer A
Marks 4
Id 10
What is the output of this C code?
#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, , 4, 5};
Question
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
A 1 2 3 junk 4 5
B Compile time error
C 123045
D 123345
Answer B
Marks 4
Unit
Id 11
What is the output of this C code?
#include <stdio.h>
void f(int a[ ][3])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
void main()
Question {
Page 3
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 12
What is the output of this C code?
#include <stdio.h>
void f(int a[ ][ ])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0;i < 2; i++)
for (j = 0;j < 3; j++)
printf("%d", a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
Question }
A 030000
B Junk 3 junk junk junk junk
C Compile time error
D All junk values
Answer C
Marks 4
Unit
Id 13
Which of the following statements are correct about 6 used in the program?
int num[6];
Question num[6]=21;
In the first statement 6 specifies a particular element, whereas in the second
A statement it specifies a type.
In the first statement 6 specifies a array size, whereas in the second statement it
B specifies a particular element of array.
In the first statement 6 specifies a particular element, whereas in the second
C statement it specifies a array size.
D In both the statement 6 specifies array size.
Answer B
Marks 2
Unit
Id 14
Which of the following statements are correct about an array?
1: The array int num[26]; can store 26 elements.
Question 2: The expression num[1] designates the very first
Page 4
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
A 1
B 1,4
C 2,3
D 2,4
Answer B
Marks 2
Unit
Id 15
What will be the output of the program ?
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
Question }
A 2,1,15
B 1,2,5
C 3,2,15
D 2,3,20
Answer C
Marks 4
Unit
Id 16
Question What will be the output of the program ?
#include<stdio.h>
int main()
{
static int a[2][2] = {1, 2, 3, 4};
int i, j;
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i));
}
}
return 0;
}
1, 1, 1, 1
A 2, 3, 2, 3
Page 5
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
3, 2, 3, 2
4, 4, 4, 4
1, 2, 1, 2
2, 3, 2, 3
3, 4, 3, 4
B 4, 2, 4, 2
1, 1, 1, 1
2, 2, 2, 2
2, 2, 2, 2
C 3, 3, 3, 3
1, 2, 3, 4
2, 3, 4, 1
3, 4, 1, 2
D 4, 1, 2, 3
Answer C
Marks 4
Unit
Id 17
What will be the output of the program ?
#include<stdio.h>
void fun(int **p);
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
Question }
A 1
B 2
C 3
D 4
Answer A
Marks 4
Id 18
Question The extra key inserted at the end of the array is called a
A End Key
B Stop Key
C Sentinel
D Transposition
Answer C
Marks 1
Id 19
Question The size of array int a[5]={1,2} is
A 4
B 12
Page 6
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
C 10
D 6
Answer C
Marks 2
Id 20
The output of the following statements is
char ch[6]={„e‟, „n‟, „d‟, „\0‟, „p‟};
Question printf(“%s”, ch);
A endp
B end0p
C end
D error
Answer C
Marks 2
Id 21
Question To declare an array S that holds a 5-character string, you would write
A char S[5]
B String S[5]
C char S[6]
D String S[6]
Answer A
Marks 1
Id 22
Question If x is one dimensional array, then pick up the correct answer
A *(x + i) is same as &x[i]
B *&x[i] is same as x + i
C *(x + i) is same as x[i] +1
D *(x + i) is same as *x[i]
Answer A
Marks 2
Unit
Id 23
What will be the output of the following code segment?
main( ) {
char s[10];
strcpy(s, “abc”);
printf(“%d %d”, strlen(s), sizeof(s));
Question }
A 3 10
B 33
C 10 3
D 10 10
Answer A
Page 7
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Marks 2
Unit
Id 24
Question What is the output of the following C++ program?
# include <stdio.h>
main ( )
{
int a, b=0;
static int c [10]={1,2,3,4,5,6,7,8,9,0};
for (a=0; a<10;+ + a)
if ((c[a]%2)= = 0) b+ = c [a];
cout<< b;
}
A 20
B 25
C 45
D 90
Answer A
Marks 2
Unit
Id 25
Question Sparse matrices have?
A no zero
B many zero
C higher dimension
D none
Answer B
Marks 1
Unit
Id 26
Consider the polynomial p(x) = a0 + a1x + a2x^2 +a3x^3, where ai != 0, for all i. The
Question minimum number of multiplications needed to evaluate p on an input x is:
A 3
B 4
C 6
D 9
Answer A
Marks 2
Unit
Id 27
Page 8
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 28
Question The elements of an array are stored successively in memory cells because
by this way computer can keep track only the address of the first element and the
A addresses of other elements can be calculated
the architecture of computer memory does not allow arrays to store other than
B serially
C both of above
D none of above
Answer A
Marks 1
Unit
Id 29
Question
Which of the following data structure is not linear data structure?
A Arrays
B Linked lists
C Both of above
D None of above
Answer D
Marks 1
Unit
Id 30
Question Finding the location of the element with a given value is:
A Traversal
B Search
C Sort
D None of above
Answer B
Marks 1
Unit
Id 31
Page 9
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 32
Question Each array declaration need not give, implicitly or explicitly, the information about
A the name of array
B the data type of array
C the first data from the set to be stored
D the index set of the array
Answer C
Marks 1
Unit
Id 33
Question Which of the following data structure is non-linear type?
A Strings
B Lists
C Stacks
D Tree
Answer D
Marks 1
Unit 2
Id 34
Question Which of the following data structure is linear type?
A Array
B Tree
C Graphs
D Hierarchy
Answer A
Marks 1
Unit 2
Id 35
Question The logical or mathematical model of a particular organization of data is called a
Page 10
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
.........
A Data structure
B Data arrangement
C Data configuration
D Data formation
Answer A
Marks 1
Unit 2
Id 36
Id 37
Question Arrays are best data structures ............
A For relatively permanent collections of data.
B For the size of the structure and the data in the structure are constantly changing
C For both of above situation
D For none of the above
Answer A
Marks 1
Unit 2
Id 38
Question Which of the following data structures are indexed structures?
A Linear arrays
B Linked lists
C Graphs
D Trees
Answer A
Marks
Unit
Id 39
Page 11
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Question Each node in a linked list has two pairs of .............. and ...................
A Link field and information field
B Link field and avail field
C Avail field and information field
Id 40
Question A ........................ does not keep track of address of every element in the list.
A Stack
B String
C Linear array
D Queue
Answer A
Marks 1
Unit 2
Id 41
Question To implement Sparse matrix dynamically, the following data structure is used
A Trees
B Graphs
C Priority Queues
D Linked List
Answer D
Marks 1
Unit 2
Id 42
Question Sparse matrix has?
A Many zero entries
B Many non-zero entries
C Higher dimension
D None of the above
Answer A
Marks 1
Unit 2
Id 43
Page 12
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
The linked list implementation of sparse matrices is superior to the generalized dope
Question vector method because it is?
A Conceptually easier
B Completely dynamic
C Efficient in accessing an entry
D A and B
Answer D
Marks 1
Unit 2
Id 44
Question An array is a collection of:
A Different data types scattered throughout memory
B Same data types scattered throughout memory
C Same data types placed next to each other in memory
D Different data types placed next to each other in memory
Answer C
Marks 1
Unit 2
Id 45
Question Which of the declaration of array are correct?
A int a(25);
B int size = 10, b[size];
C int c = {0, 1, 2};
Id 46
What is the difference between the 5‟s in these two expressions?(Select the correct
option)
int num[5];
Question num[5] = 11;
A First is particular element, second is type
B First is array size, second is particular element
C First is particular element, second is array size
D Both specify array size
Answer B
Marks 2
Unit 2
Page 13
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 47
Let A be a square matrix of size n x n. Consider the following program. What is the
expected output?
C = 100
for i = 1 to n do
for j = 1 to n do
{
Temp = A[i][j] + C
A[i][j] = A[j][i]
A[j][i] = Temp - C
}
for i = 1 to n do
for j = 1 to n do
Question Output(A[i][j]);
A The matrix A itself
B Transpose of matrix A
Adding 100 to the upper diagonal elements and subtracting 100 from diagonal
C elements of A
D None of the above
Answer A
Marks 4
Unit 2
Id 48
The minimum number of arithmetic operations required to evaluate the polynomial
Question P(X) = X5 + 4X3 + 6X + 5 for a given value of X using only one temporary variable.
A 6
B 7
C 8
D 9
Answer B
Marks 2
Unit 2
Id 49
Consider the following C++ function in which size is the number of elements in the
array E:
The value returned by the function MyX is the
int MyX(int *E, unsigned int size)
{
int Y = 0;
int Z;
int i, j, k;
Page 14
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 50
If array A is made to hold the string “abcde”, which of the following four test cases
will be successful in exposing the flaw in this procedure?
(1) oldc = "abc", newc = "dab"
(2) oldc = "cde", newc = "bcd"
(3) oldc = "bca", newc = "cda"
Question (4) oldc = "abc", newc = "bac"
A None
B 2 only
C 3 and 4 only
D 4 only
Answer C
Marks 4
Unit 2
Id 51
A program P reads in 500 integers in the range [0..100] representing the scores of
500 students. It then prints the frequency of each score above 50. What would be the
Question best way for P to store the frequencies?
A An array of 50 numbers
B An array of 100 numbers
C An array of 500 numbers
D A dynamically allocated array of 550 numbers
Answer A
Marks 4
Unit 2
Id 52
Consider the following C++ program that attempts to locate an element x in an
array Y[] using binary search. The program is erroneous.
f(int Y[10], int x) {
int i, j, k;
Question i = 0; j = 9;
Page 15
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
do {
k = (i + j) /2;
if( Y[k] < x) i = k; else j = k;
} while(Y[k] != x && i < j);
if(Y[k] == x) cout<<"x is in the array " ;
else cout<<" x is not in the array " ;
}
On which of the following contents of Y and x does the program fail?
A Y is [1 2 3 4 5 6 7 8 9 10] and x < 10
B Y is [1 3 5 7 9 11 13 15 17 19] and x < 1
C Y is [2 2 2 2 2 2 2 2 2 2] and x > 2
D Y is [2 4 6 8 10 12 14 16 18 20] and 2 < x < 20 and x is even
Answer C
Marks 4
Unit 2
Id 53
Consider the following C++ program that attempts to locate an element x in an
array Y[] using binary search. The program is erroneous.
f(int Y[10], int x) {
int i, j, k;
i = 0; j = 9;
do {
k = (i + j) /2;
if( Y[k] < x) i = k; else j = k;
} while(Y[k] != x && i < j);
if(Y[k] == x) cout<<"x is in the array " ;
else cout<<" x is not in the array " ;
}
Question What is the correction needed in the program to make it work properly?
A Change line 6 to: if (Y[k] < x) i = k + 1; else j = k-1;
B Change line 6 to: if (Y[k] < x) i = k - 1; else j = k+1;
C Change line 6 to: if (Y[k] <= x) i = k; else j = k;
D Change line 7 to: } while ((Y[k] == x) && (i < j));
Answer A
Marks 4
Unit 2
Id 54
A set X can be represented by an array x[n] as follows:
Consider the following algorithm in which x,y and z are Boolean arrays of size n:
algorithm zzz(x[] , y[], z [])
{
int i;
for (i=O; i<n; ++i)
z[i] = (x[i] ^ ~y[i]) V (~x[i] ^ y[i])
}
Question The set Z computed by the algorithm is:
Page 16
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
A (X Intersection Y)
B (X Union Y)
C (X-Y) Intersection (Y-X)
D (X-Y) Union (Y-X)
Answer D
Marks 4
Unit 2
Id 55
Question Array name indicates________
A Just the name of array
Id 56
Question The array subscript always start at ________
A 1
B -1
C 0
D Any position
Answer C
Marks 1
Unit 2
Id 57
Question Array elements occupy______
A Varying length of memory locations for each element
B Subsequent memory locations
C Random memory locations
D None of these
Answer B
Marks 1
Unit 2
Id 58
Question In arrays ______ and ______ are difficult but ______ is easy operation.
Page 17
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Id 59
What is the output for following program?
void main()
{
int a[5]={3,4};
cout<<a[2]<<a[3]<<a[4];
Question }
A 211
B Garbage value
C 122
D 000
Answer D
Marks 1
Unit 2
Id 60
What is the output for following program?
void main()
{
int i=0,a[3];
a[i] = i++;
cout<<a[i];
Question }
A Garbage value
B Syntax error
C 1
D 0
Answer A
Marks 1
Unit 2
Id 61
Question In Linked list, the logical order of elements ________
A Is determined by their physical arrangement
B Cannot be determined by their physical arrangement
C Is the same as their physical arrangement
D None of these.
Page 18
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
Answer B
Marks 1
Unit 2
Id 62
Question In CLL, insertion of a record involves modification of……
A 1 pointer
B 2 pointers
C No pointer
D 3 pointers
Answer B
Marks 2
Unit 2
Id 63
Question For traversing a list, which pointer do you need?
A NULL
B Insertion
C Beginning
D Walking
Answer C
Marks 1
Unit 2
Id 64
Question The nth node in SLL, is accessed via ________
A Tail node
B Head node
C (n-1) nodes
D None of these
Answer B
Marks 1
Unit 2
Id 65
What is the output of this c++ code?
void main()
{
int a[2][3] = {1,2,3,4,5}
int i=0,j=0;
for(i=0 ; i<2 ; i++)
for(j=0 ; j<3 ; j++)
Question cout<<a[i][j];
Page 19
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
A 1 2 3 4 5 junk
B 123455
C 123450
D Run time error
Answer C
Marks 2
Unit 2
Id 66
Question Which of the following data structures are indexed structure?
A L
Trees
B Linked list
C Linear arrays
D All of these
Answer B
Marks 1
Unit 2
Id 67
When new data is to be inserted into a data structure, but there is no available space
Question is called ________________
A Overflow
B Saturated
C Houseful
D Underflow
Answer B
Marks 1
Unit
Id 68
Question Array name is ______
A An array variable
B A common name shared by all elements
C A keyword
D Not used in a program
Answer B
Marks 1
Unit 2
Id
Page 20
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
ID 69
Question Missing elements of partially initialized arrays are ………
A Set to zero
B Not defined
C Invalid
D Set to one
Answer C
Marks 1
Unit 2
ID 70
Question Two-way list may be maintained in memory by means of .............
A Queues
B Linear arrays
C Non linear arrays
D Stacks
Answer B
Marks 1
Unit 2
ID 71
Question Sparse matrices have?
A many zero entries
B many non- zero entries
C higher dimension
D none of above
Answer A
Marks 1
Unit 2
ID 72
Question Two dimensional arrays are also called ?
Page 21
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
A Matrix Array
B Table Array
C Both a and b
D None of the Above
Answer C
Marks 1
Unit 2
ID 73
Question Which of the following function sets first n characters of a string to a given character?
A strinit()
B strnset()
C strset()
D strcset()
Answer B
Marks 1
Unit 2
ID 74
Question If the two strings are identical, then strcmp() function returns
A -1
B 1
C 0
D 2
Answer C
Marks 1
Unit 2
ID 75
Question The library function used to find the last occurrence of a character in a string is
A strnstr()
B laststr()
C strrchr()
D strstr()
Answer C
Marks 1
Unit 2
ID 76
Which of the following function is used to find the first occurrence of a given string
Question in another string?
A strchr()
Page 22
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
B strrchr()
C strstr()
D strnset()
Answer C
Marks 1
Unit 2
ID 77
Which of the following function is more appropriate for reading in a multi-word
Question string?
A printf();
B scanf();
C gets();
D puts();
Answer C
Marks 1
Unit 2
ID 78
Question Which of the following function is correct that finds the length of a string?
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
{ length++; s++; }
return (length);
}
A
int xstrlen(char s)
{
int length=0;
while(*s!='\0')
length++; s++;
return (length);
}
B
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
length++;
return (length);
}
C
int xstrlen(char *s)
{
int length=0;
while(*s!='\0')
s++;
return (length);
}
D
Answer A
Marks 4
Unit 2
ID 79
Page 23
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
ID 80
Question
A
B
C
D
Answer
Marks
Unit 2
ID 81
What will be printed after execution of the following code?
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
Question }
A Garbage Value
B 5
C 6
D 0
Answer D
Marks 1
Unit 2
ID 82
Question What is right way to Initialize array?
A int num[6] = { 21, 41, 2, 15, 4, 5 };
B int n{} = { 21, 41, 2, 15, 4, 5 };
C int n{6} = { 21, 41, 2 };
D int n(6) = { 21, 41, 2, 15, 4, 5 };
Answer A
Marks 1
Unit 2
Page 24
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
ID 83
What will be the output of the following code?\
#include"stdio.h"
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
Question }
A 00
B Garbage value 0
C 0 Garbage Value
D Garbage value Garbage Value
Answer D
Marks 2
Unit 2
ID 84
Let x be an array. Which of the following operations are illegal?
1. ++X
2. X+1
3. X++
Question 4. X*2
A I and II
B I, II and III
C II and III
D I, III and IV
Answer D
Marks 2
Unit 2
ID 85
Question What is the maximum number of dimensions an array in C may have?
A 2
B 8
C 20
D Theoretically no limit. The only practical limits are memory size and compilers
Answer D
Marks 1
Unit 2
ID 86
What will be the output of the program?
#include"stdio.h"
int main()
Question {
Page 25
Data Structures & Algorithms , M.C.Q. BANK, FOR UNIT -2 , SECOND YEAR COMP. ENGG. SEM-1, 2016 PATTERN ,
U.O.P.
return 0;
}
A 1
B 0
C 10
D 6
Answer C
Marks 2
Unit 2
ID
Question
A
B
C
D
Answer
Marks
Unit
ID
Question
A
B
C
D
Answer
Marks
Unit
ID
Question
A
B
C
D
Answer
Marks
Unit
Page 26