Programming and Data Structure Solved MCQs Part 2 Book
Programming and Data Structure Solved MCQs Part 2 Book
http://freepdf-books.com
Programming and Data Structure Solved
MCQs- Part 2
Two bytes
Four bytes
One byte
Eight byte
________________________________________________________
A weather forecasting computation requires 250 billion floating point
operations. The problem is processed in a supercomputer that ca
perform 100 mega flops. How long will it take to do these
calculations.
4167 min
40 min
52.67 min
60.12 min
________________________________________________________
The value that follows the keyword CASE may only be
Constants
Variable
Number
Semicolon
________________________________________________________
A data structure whose elements from a sequence is known as
http://freepdf-books.com
________________________________________________________
The process of production of customer list in alphabetical order falls
under the category of
Editing
Sorting
Updating
Calculating
________________________________________________________
If an array is used as function argument, the array is passed
By value
By reference
By name
The array cannot be used as a function argument
________________________________________________________
Binary search tree is an example of
Abacus
Clock
Difference
None of these
________________________________________________________
Which of the following data structure is non-linear type?
Strings
Lists
http://freepdf-books.com
Stacks
None of above
________________________________________________________
What value would the following function return for the input x=95
Function fun (int x)
{
if(x>100)
{
return fun(x-10)
}
else
return fun(fun(x+11))
}
91
90
89
92
________________________________________________________
A data structure in which linear sequence is maintained by pointers
is known as
Symbol table
Activation table
System table
Dope vector
________________________________________________________
http://freepdf-books.com
char c[] "GATE2011";
char *p =c;
printf ("%s", p+p[3]-p [1] );
GATE2011
E2011
2011
011
________________________________________________________
From the point of view of the programmer, what are the major
advantages of using a high-level language rather than internal
machine code or assembly language ?
Program portability
Easy development
Efficiency
None of the above
________________________________________________________
By default real number is treated as
Float
Double
Long double
Far double
________________________________________________________
Which of the following data structure is used to represent
relationship between pairs, where relationship is not hierarchical ?
Graph
Tree
Hash Table
Queue
________________________________________________________
What is the output of the following program segment?
main()
http://freepdf-books.com
{
int i = ++2;
printf(“%d\n”, i);
}
3
2
0
-1
________________________________________________________
‘C’ allows a three-way transfer of control with the help of
Unary operator
Relational operator
Ternary operator
Comparison operator
________________________________________________________
The postfix expression AB + CD – * can be evaluated using a
stack
tree
queue
linked list
________________________________________________________
C language was invented by
Abacus
Charles babage
Thomson
Dennis Ritchie
________________________________________________________
What is the output of the following program segment?
main()
{
int i = 1;
do
http://freepdf-books.com
{
printf(“%d..”, i);
}
while(i--);
}
0..1..
1..0..
0
-1
________________________________________________________
Suppose a circular queue of capacity (n -1) elements is implemented
with an array of n elements. Assume that the insertion and deletion
operations are carried out using REAR and FRONT as array index
variables, respectively. Initially, REAR = FRONT = 0. The conditions
to detect queue full and queue empty are
http://freepdf-books.com
Consider the following program
main ( )
{ float a = 0.5, b = 0.7;
if (b < 0.8)
if (a < 0.5) printf (“ABCD”);
else printf (“PQR”);
else printf (“JKLF);
}
The output is
ABCD
PQR
JKLF
None of these
________________________________________________________
What would be the output of the following program, if run from the
command line as “myprog 1 2 3” ?
main (int argc, char * argv[ ])
{ int i ;
i = argv[1] + argv[2] + argv[3] ;
printf (“% d”, i) ;
}
123
6
Error
“123”
________________________________________________________
The expression P >> 6 shifts all bits of P six places to right. What is
the value of P >> 6 if P 0.6db7 ?
0.1234
0.0001
0.0000
0.1B6
________________________________________________________
The process of accessing data stored in a serial access memory is
http://freepdf-books.com
similar to manipulating data on a
Heap
Queue
Stack
Binary tree
________________________________________________________
Queue is a ----------- list.
LIFO
LILO
FILO
FIFO
________________________________________________________
Linked lists are not suitable data structures for which one of the
following problems
Insertion sort
Binary search
Radix sort
Polynomial manipulation
________________________________________________________
The << operator is used for
Right shifting
Right shifting
Bitwise shifting
Bitwise complemen
________________________________________________________
In a circular linked list
http://freepdf-books.com
Forward and backward traversal within the list is permitted
________________________________________________________
If binary tree has n leaf nodes,then number of nodes of degree 2 in T
is
log2n
n-1
n
2n
________________________________________________________
Consider the following C code segment.
int a, b, c = 0;
void prtFun(void);
main( )
{ static int a = 1; /* Line 1 */
prtFun( );
a += 1;
prtFun( );
printf(“ \n %d %d ”, a, b);
}
void prtFun(void)
{ static int a = 2; /* Line 2 */
int b = 1;
a += ++b;
printf(“ \n %d %d ”, a, b);
}
What output will be generated by the given code segment?
31
41
42
42
61
61
42
62
20
31
52
52
________________________________________________________
http://freepdf-books.com
Following sequence of operations is performed on a stack:
PUSH (10), PUSH(20), POP,PUSH (10), PUSH (20),POP, POP, POP,
PUSH (20), POP
20,10,20,10,20
20,20,20,10,20
20,10,20,10,10
20,20,10,10,20
________________________________________________________
Output of the program given below is
int i;
main()
{
printf(“%d”, i)
1
0
-1
NULL
________________________________________________________
Usually, an algorithm will contain a number of procedural steps
which are dependent on results of previous steps and is called
_______________.
Flowchart
Chart
Drawing Chart
Food Chart
________________________________________________________
What would be output of the following program? # define SQR(X)
(X*X) main() { int a, b=3; a = SQR(b+2); printf(“\n%d”, a); }
25
11
Error
http://freepdf-books.com
Garbage value
________________________________________________________
The efficient data structure to insert/delete a number in a stored set
of numbers is
Queue
Linked list
Doubly linked list
Binary tree
________________________________________________________
How many times the following program would print (“abc”)? main() {
printf(“\nabc”); main(); }
When the following code is executed what will be the value of x and y
?
int x = 1, y = 0;
y = x++;
2,1
2,2
1,1
1,2
________________________________________________________
Which of the following is a bad example of recursion ?
Factorial
Fibonacci numbers
Tower of Hanai
http://freepdf-books.com
Tree traversal
________________________________________________________
An advantage of choosing this implementation of \set of integers" is
that adding an element to a set is a contact time operation. Which of
the following is a disadvantage of this implementation?
2
3
4
5
________________________________________________________
What would be output of the following program, if the array begins at
65486?
main()
{
int arr[ ] = {12, 14, 15, 23, 45};
printf(“%u%u”, arr+1, &arr+1);
}
65486, 65486
65488, 65488
65488, 65496
None of the above
________________________________________________________
The name of all functions end with a
Pair of parenthesis
http://freepdf-books.com
Semicolon
Braces
Colon
________________________________________________________
A template stores
Styles, macros
Auto Text entires, Customized word command Settings
Graphics, text
All of the above
________________________________________________________
What would be output of the following program?
# define SQR(X) (X*X)
main()
{
int a, b=3;
a = SQR(b+2);
printf(“\n%d”, a);
}
25
11
Error
Garbage value
________________________________________________________
The decimal value 0.5 in IEEE single precision floating point
representation has
Simulation of recursion
http://freepdf-books.com
Simulation of arbitrary linked list
Simulation of limited resources
Expression evaluation
________________________________________________________
Number of binary trees formed with 5 nodes are
32
64
120
42
http://freepdf-books.com