C/C++/OS/DS/Networking Test Set 1

1)   What will be the output of the following program?

void main()
{
int x=300*400/300;
printf("%d",x);
}


a. 300
b. None of these
c. 400
d. 100
Answer  Explanation 

ANSWER: 400

Explanation:
No explanation is available for this question!


2)   Trace the output.

void main()
{
printf("%d",-5%3);
}


a. 1
b. 2
c. -2
d. 2.5
Answer  Explanation 

ANSWER: -2

Explanation:
No explanation is available for this question!


3)   Trace the output.

void main()
{
int x=10,y=20;
x=!x;
y=!y;
printf("x=%d , y=%d",x,y);
}


a. x= -10 , y= -20;
b. x= 10 , y= 20;
c. x=0 , y=0;
d. None of the above.
Answer  Explanation 

ANSWER: x=0 , y=0;

Explanation:
No explanation is available for this question!


4)   Trace the output.

void main()
{
int x=-5,y,num=5;
y=x%-4;
y=(y?0:num*num);
printf("%d",y);
}


a. 0
b. 25
c. -25
d. None of the above.
Answer  Explanation 

ANSWER: 0

Explanation:
No explanation is available for this question!


5)   Recursive functions are executed in a

a. LIFO order.
b. FIFO order.
c. Random order.
d. None of the above.
Answer  Explanation 

ANSWER: LIFO order.

Explanation:
No explanation is available for this question!


6)   Which of the following operation can be applied to pointer variable?

a. Multiplication
b. Division.
c. Addition.
d. All of the above.
Answer  Explanation 

ANSWER: Addition.

Explanation:
No explanation is available for this question!


7)   Which of the following are essential features of an object oriented programming language?

1. Abstraction and encapsulation.
2. Strictly-typed
3. Type-safe property coupled with sub-type rule.
4. Polymorphism in the presence of inheritance.


a. 1 and 2
b. 1 and 4
c. 1, 2, and 4
d. 1, 3 and 4
Answer  Explanation 

ANSWER: 1 and 4

Explanation:
No explanation is available for this question!


8)   How many constructors can a class have?

a. 0
b. 1
c. 2
d. Any number
Answer  Explanation 

ANSWER: Any number

Explanation:
No explanation is available for this question!


9)   Match the following List-1 with List-2
List-1 - - - - - - - - - - - - - - - - - - - - - - - - List-2
P. Functional - - - - - - - - - - - - - - - - - - 1.Command-based, procedural.
Q. Logic - - - - - - - - - - - - - - - - - - - - - - 2.Imperative, abstract data types.
R. Object oriented - - - - - - - - - - - - - - - 3.Side effect free, declarative, expression evaluation.
S. Imperative - - - - - - - - - - - - - - - - - - -4.Declarative, clausal representation, theorem proving.


a. P-2, Q-3, R-4, S-1
b. P-4, Q-3, R-2, S-1
c. P-3, Q-4, R-1, S-2
d. P-3, Q-4, R-2, S-1
Answer  Explanation 

ANSWER: P-3, Q-4, R-2, S-1

Explanation:
No explanation is available for this question!


10)   Trace the output.

#include< iostream.h>
# define SQUARE(x) x*x
inline float square(float y)
{

return y*y;

}
int main( )

{

float a = 0.5, b = 0.5, c, d;
c = SQUARE(++a);
d = square(++b);
cout << c << endl << d;
return 0;

}


a. 6.25, 2.25
b. 2.25, 2.25
c. Compile time error.
d. None of the above.
Answer  Explanation 

ANSWER: 6.25, 2.25

Explanation:
No explanation is available for this question!


11)   Trace the output.

void main ( )
{

char s[ ] = "CLASS";
int i;
for (i=0; s[i]; i++)
cout << "\n" << s[i] << *(s+i) << *(i + s) << i[s];
}


a.
C
L
A
S
S
b.
CLASS
CLASS
CLASS
CLASS
CLASS
c.
CCCC
LLLL
AAAA
SSSS
SSSS
d. None of the above.
Answer  Explanation 

ANSWER:
CCCC
LLLL
AAAA
SSSS
SSSS

Explanation:
No explanation is available for this question!


12)   CPU can access which type of memory directly?

a. random-access memory
b. magnetic disk
c. magnetic tape
d. None of the above.
Answer  Explanation 

ANSWER: random-access memory

Explanation:
No explanation is available for this question!


13)   Match the following:
List – I - - - - - - - - - - - - - - - - - - - - - - - - - List – II
a. Multilevel feedback queue - - - - - - - - - i. Time-slicing
b. FCFS - - - - - - - - - - - - - - - - - - - - - - - -ii. Criteria to move processes between queues
c. Shortest process next - - - - - - - - - - - -iii. Batch processing
d. Round robin scheduling - - - - - - - - - - -iv. Exponential smoothing


a. a-i, b-iii, c-ii, d-iv
b. a-iv, b-iii, c-ii, d-i
c. a-iii, b-i, c-iv, d-i
d. a-ii, b-iii, c-iv, d-i
Answer  Explanation 

ANSWER: a-ii, b-iii, c-iv, d-i

Explanation:
No explanation is available for this question!


14)   Interrupts which are initiated by an instruction are

a. Internal
b. External
c. Hardware
d. Software
Answer  Explanation 

ANSWER: Software

Explanation:
No explanation is available for this question!


15)   Where does a computer add and compare data?

a. Hard disk
b. Floppy disk
c. CPU chip
d. Memory chip
Answer  Explanation 

ANSWER: CPU chip

Explanation:
No explanation is available for this question!


16)   The volatile storage is/are

a. Main memory
b. Cache
c. Register
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


17)   Which of the following is correct regarding operating system?

a. It manages the computer hardware.
b. It executes user programs.
c. Provide system services to the application.
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


18)   Which of the following is/are non-primitive data structures?

a. Arrays, Linklist
b. Stack, Queue
c. Tree, Graph
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


19)   Choose the correct option about abstract data type(ADT).

a. An abstract data type is a model of a certain kind of data structure.
b. In abstract data type we know what a specific data type can do, but how it actually does it is hidden.
c. ADT is user defined type.
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


20)   It is a set of data values and associated operations that are specified accurately, independent of any particular implementation.

a. Stack
b. ADT
c. Graph
d. Tree
Answer  Explanation 

ANSWER: ADT

Explanation:
No explanation is available for this question!


21)   The number of possible binary trees with 5 nodes is.

a. 40
b. 41
c. 42
d. 32
Answer  Explanation 

ANSWER: 42

Explanation:
If there are n nodes then the number of possible binary trees is (1/n+1)*(2nCn)


22)   Match the following List-1 with List-2

List-1 - - - - - - - - - - - - - - - - - - - - - - List-2
P. Greedy algorithm - - - - - - - - - - - -1. Merge sort, quick sort
Q. Divide and Conquer - - - - - - - - - - 2.Eight Queens Problem.
R. Backtracking - - - - - - - - - - - - - - - 3.Dijkstra’s algorithm, prim’s algorithm               


a. P-3, Q-1, R-2
b. P-1, Q-3, R-2
c. P-1, Q-2, R-3
d. None of the above.
Answer  Explanation 

ANSWER: P-3, Q-1, R-2

Explanation:
No explanation is available for this question!


23)   What is the complexity of the function f(n)= nlogn+logn+1

a. O(logn)
b. O(nlogn)
c. O(n)
d. None of the above.
Answer  Explanation 

ANSWER: O(nlogn)

Explanation:
No explanation is available for this question!


24)   Match the following:
List – I - - - - - - - - - - - - - - - - -List – II
a. Attenuation - - - - - - - - - - - -i. External energy that corrupts a signal.
b. Distortion - - - - - - - - - - -- - -ii. Loss of a signal's energy
c. Noise - - - - - - - - - - - - -- - -- iii. Alteration of a signal


a. a-iii, b-ii, c-i
b. a-iii, b-i, c-ii
c. a-ii, b-iii, c-i
d. There is no matching pair.
Answer  Explanation 

ANSWER: a-ii, b-iii, c-i

Explanation:
No explanation is available for this question!


25)   Which unit measures the relative strength of two signals?

a. decible
b. hertz
c. picko
d. None of the above.
Answer  Explanation 

ANSWER: decible

Explanation:
No explanation is available for this question!


26)   Bandwidth can be described as:

a. The range of frequencies in a composite signal.
b. The range of frequencies that a channel can pass.
c. The number of bits per second that a channel can transmit.
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


27)   Before data can be transmitted in a network, they must be transformed to.

a. Binary
b. Electromagnetic signals
c. Radio signal
d. None of the above.
Answer  Explanation 

ANSWER: Electromagnetic signals

Explanation:
No explanation is available for this question!


28)   If you increase the frequency, the period of signal will be.

a. No effect
b. Increases
c. Decreases
d. Double
Answer  Explanation 

ANSWER: Decreases

Explanation:
No explanation is available for this question!


29)   What will you get when propagation speed is multiplied by propagation time?

a. Distance a signal or bit has travelled
b. Throughput
c. Latency
d. None of the above.
Answer  Explanation 

ANSWER: Distance a signal or bit has travelled

Explanation:
No explanation is available for this question!


30)   Which operation can be applied to pointer variable?

a. Multiplication
b. Division.
c. Addition.
d. All of the above.
Answer  Explanation 

ANSWER: Addition.

Explanation:
No explanation is available for this question!