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

1)   Which of the following does not represent a valid storage class in c?

a. static
b. union
c. extern
d. automatic
Answer  Explanation 

ANSWER: union

Explanation:
No explanation is available for this question!


2)   Trace the output.

int main()
{
   int i = 5;
   int *j;
   int **k;
   j=&i;
   k=&j;
   printf("%u %u %d ",k,*k,**k);
   return 0;
}


a. some address, some address, 5
b. some address, 5, 5
c. 5 , 5 , 5
d. None of the above.
Answer  Explanation 

ANSWER: some address, some address, 5

Explanation:
No explanation is available for this question!


3)   Trace the output

void main()
{
register R=20;
int * P=&R;
printf(“%d”, *P);
}


a. some address.
b. 20
c. Compile time error.
d. None of the above.
Answer  Explanation 

ANSWER: Compile time error.

Explanation:
No explanation is available for this question!


4)   A pointer in c which has not been initialized is known as

a. far pointer
b. void pointer
c. null pointer
d. wild pointer
Answer  Explanation 

ANSWER: wild pointer

Explanation:
No explanation is available for this question!


5)   Trace the output.

extern int P
void main()
{
printf(“%d”, P);
}


a. Error
b. 0
c. P
d. None of the above
Answer  Explanation 

ANSWER: Error

Explanation:
No explanation is available for this question!


6)   Which of the following statement is\are correct?

a. Default initial value of static integral type variables is zero.
b. A same static variable can be declared many times but we can initialize at only one time.
c. Option A and B are correct.
d. None of the above.
Answer  Explanation 

ANSWER: Option A and B are correct.

Explanation:
No explanation is available for this question!


7)   C++ : There is two types of polymorphism, Compile time and Runtime polymorphism. Runtime polymorphism can be achieved through.

a. function overloading
b. virtual function
c. operator overloading
d. None of the above.
Answer  Explanation 

ANSWER: virtual function

Explanation:
No explanation is available for this question!


8)   In C++, dynamic memory allocation is achieved with the operator

a. new
b. this
c. malloc( )
d. calloc()
Answer  Explanation 

ANSWER: new

Explanation:
No explanation is available for this question!


9)   How many arguments are in copy constructor?

a. No argument
b. Any number of arguments.
c. One argument
d. None of the above.
Answer  Explanation 

ANSWER: One argument

Explanation:
No explanation is available for this question!


10)   C++ : Trace the output.

class base
{
private: int x;
protected: int y;
public:
base()
{
   x=10;
   y=20;
}
};
class derived : public base
{
protected:
int a, b;
void change( )
{
a=x;
b=y;
cout << a << b;
}
};
void main()
{
derived  obj;
obj.change();
}


a. 10 20
b. Run time error.
c. Compile time error.
d. None of the above
Answer  Explanation 

ANSWER: Compile time error.

Explanation:
No explanation is available for this question!


11)   void main()
{
float x=5,y=2;
int result;
result=x % y;
cout << result;
}


a. 1
b. 2.5
c. 1.0
d. Error
Answer  Explanation 

ANSWER: Error

Explanation:
No explanation is available for this question!


12)   C++: What will be the result of the expression 13 & 25?

a. 12
b. 25
c. 9
d. 0
Answer  Explanation 

ANSWER: 9

Explanation:
No explanation is available for this question!


13)   Which technique is used to temporarily removing non-active programs from the memory of computer system?

a. Swapping
b. Spooling
c. Scheduler
d. None of the above.
Answer  Explanation 

ANSWER: Swapping

Explanation:
No explanation is available for this question!


14)   In which of the following page replacement policies Balady’s anomaly occurs?

a. Most recently used.
b. LRU
c. FIFO
d. Optimal page replacement policy.
Answer  Explanation 

ANSWER: FIFO

Explanation:
No explanation is available for this question!


15)   If a process supposes that Pi is executing in its critical section, then no other processes can be executing in their critical sections. This situation is called as

a. race condition.
b. mutual exclusion
c. Critical section
d. None of the above.
Answer  Explanation 

ANSWER: mutual exclusion

Explanation:
No explanation is available for this question!


16)   Deadlocks can be described by which graph?

a. Resource-Allocation Graph
b. Hamilton Graph
c. Complete Graph
d. None of the above.
Answer  Explanation 

ANSWER: Resource-Allocation Graph

Explanation:
No explanation is available for this question!


17)   Choose the correct option regarding deadlock.

a. If a resource-allocation graph contains no cycles, then no process in the system is deadlocked.
b. If the graph does contain a cycle, then a deadlock may exist.
c. Only A
d. Option A and B are correct.
Answer  Explanation 

ANSWER: Option A and B are correct.

Explanation:
No explanation is available for this question!


18)   Which of the following is deadlock avoidance algorithm?

a. round-robin algorithm
b. banker's algorithm
c. Multilevel feedback
d. None of the above.
Answer  Explanation 

ANSWER: banker's algorithm

Explanation:
No explanation is available for this question!


19)   What is the most appropriate data structure to implement a priority queue?

a. Heap
b. Circular array
c. Linked list
d. Binary tree
Answer  Explanation 

ANSWER: Heap

Explanation:
No explanation is available for this question!


20)   What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm?

a. LinkList
b. Stack
c. Queue
d. Tree
Answer  Explanation 

ANSWER: Stack

Explanation:
No explanation is available for this question!


21)   If a binary tree has 25 nodes, then how many null branches are there?

a. 54
b. 27
c. 26
d. None of the above
Answer  Explanation 

ANSWER: 26

Explanation:
No explanation is available for this question!


22)   In a graph the number of vertices of odd degree is always

a. even
b. odd
c. sometimes odd sometimes even
d. None of the above.
Answer  Explanation 

ANSWER: even

Explanation:
No explanation is available for this question!


23)   In an undirected graph, the sum of degrees of all vertices is

a. Odd
b. Even
c. Even and odd both.
d. None of the above.
Answer  Explanation 

ANSWER: Even

Explanation:
No explanation is available for this question!


24)   If a complete graph has n vertices then what will be the no of edges?

a. n-1
b. (n-1)/2
c. (1/2) n (n-1)
d. None of the above.
Answer  Explanation 

ANSWER: (1/2) n (n-1)

Explanation:
No explanation is available for this question!


25)   Which Layer is not present in TCP/ IP model?

a. Application Layer
b. Internet Layer
c. Transport Layer
d. Presentation Layer
Answer  Explanation 

ANSWER: Presentation Layer

Explanation:
No explanation is available for this question!


26)   Go-Back-N and Selective-Repeat Protocols uses

a. sliding window
b. sliding frame
c. sliding packet
d. None of the above.
Answer  Explanation 

ANSWER: sliding window

Explanation:
No explanation is available for this question!


27)   DHCP stands for

a. Dynamic Host Control Protocol
b. Dynamic Host Configuration Protocol.
c. Dynamic Host Connection Protocol.
d. None of the above.
Answer  Explanation 

ANSWER: Dynamic Host Configuration Protocol.

Explanation:
No explanation is available for this question!


28)   High-level Data Link Control (HDLC) protocol for communication over point-to-point and multipoint links is a?

a. byte-oriented
b. character-oriented
c. bit-oriented
d. None of the above.
Answer  Explanation 

ANSWER: bit-oriented

Explanation:
No explanation is available for this question!


29)   Which protocol has flow control, but not error control?

a. Simplest
b. Selective-Repeat ARQ
c. Go-Back-N ARQ
d. Stop-and-Wait
Answer  Explanation 

ANSWER: Stop-and-Wait

Explanation:
No explanation is available for this question!


30)   Which of the following is random access protocol?

a. ALOHA
b. carrier sense multiple access (CSMA)
c. carrier sense multiple access with collision detection (CSMA / CD)
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!