Programming and Data Structure Solved MCQs- Part 2


Unsigned integers occupies 

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

Non-linear Data Structure
Linear Data Structure
Homogeneous Data Structure
Heterogeneous Data Structure
      _____________________________________________________________________________________
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

Divide and conquer
Greedy algorithm
Back tracking
Dynamic programming
      _____________________________________________________________________________________
The earliest calculating devices are 

Abacus
Clock
Difference
None of these
      _____________________________________________________________________________________
Which of the following data structure is non-linear type? 

Strings
Lists
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

Pointer based data structure
Stack
Array
Linklist
      _____________________________________________________________________________________
The information about an array used in a program will be sorted in

Symbol table
Activation table
System table
Dope vector
      _____________________________________________________________________________________

What does the following fragment of C-program print?
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()
{
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
{
 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

full: (REAR+1) mod n == FRONT
empty: REAR == FRONT
full: (REAR+1) mod n == FRONT
empty: (FRONT+1) mod n == REAR
full: REAR == FRONT
empty: (REAR+1) mod n == FRONT
full: (FRONT+1) mod n == REAR
empty: REAR == FRONT
      _____________________________________________________________________________________

Consider the following sequence of operations :
(i) Pointer p1 is set to point at a new heap-dynamic variable.
(ii) Pointer p2 is assigned p1 value.
(iii) The heap dynamic variable pointed to by p1 is explicitly de-allocated, but p2 is not changed by the operation. This situation leads to which of the following :


p1 becomes a dangling pointer
p2 becomes a dangling pointer
Both p1 and p2 are now dangling pointers
Neither p1 nor p2 is now a dangling pointer
      _____________________________________________________________________________________
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 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 

Components are all linked together in some sequential manner
There is no beginning and no end
Components are arranged hierarchically
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?


3 1
4 1
4 2
4 2
6 1
6 1
4 2
6 2
2 0
3 1
5 2
5 2
      _____________________________________________________________________________________
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
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(); }

Infinite number of times
32767 times
65535 times
Till the stack does not overflow
      _____________________________________________________________________________________

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
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?

Adding elements to a very small sets could cause error flags to be raised.
Deleting elements from very large sets could cause error °ags to be raised.
Deleting elements from very large sets could cause error °ags to be raised.
Constructing the union of two sets will require quadratic time in the size of the set being constructed.
      _____________________________________________________________________________________
The number of different directed trees with 3 nodes are

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
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

fraction bits of 000…000 and exponent value of 0
fraction bits of 000…000 and exponent value of -1
fraction bits of 100…000 and exponent value of 0
no exact representation
      _____________________________________________________________________________________
Queues serve a major role in

Simulation of recursion
Simulation of arbitrary linked list
Simulation of limited resources
Expression evaluation
      _____________________________________________________________________________________
Number of binary trees formed with 5 nodes are

32
64
120
42
Previous Post Next Post