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

1)   C programming : Match the following:

a. calloc( )  ------- i. Frees previouslyallocated space.
b. free( ) ----------- ii. Modifiespreviouslyallocated space.
c. malloc( ) ------- iii. Allocates spacefor array.
d. realloc( ) ------- iv. Allocatesrequested size ofspace.


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

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

Explanation:
No explanation is available for this question!


2)   C programming : Trace the output.

void main()
{
    int i=2,j=2;
    while(i+1?--i:j++)
         printf("%d",i);    
}


a. 1
b. 2
c. ERROR
d. None of the above.
Answer  Explanation 

ANSWER: 1

Explanation:
No explanation is available for this question!


3)   C programming : Trace the output

int main()
{
    int a=12,b=39;
    printf ("%d",a&b);
    return 0;
}


a. 468
b. 0
c. 4
d. None of the above.
Answer  Explanation 

ANSWER: 4

Explanation:
No explanation is available for this question!


4)   C programming : If you want to store dissimilar data together, then which type you will use?

a. array
b. structure
c. stack
d. None of the above.
Answer  Explanation 

ANSWER: structure

Explanation:
No explanation is available for this question!


5)   C programming : Suppose that x is a one dimensional array, then choose the correct answer regarding array.

a. *(x + n) is same as &x[n]
b. *&x[n] is same as x + n
c. *(x + n) is same as x[n] +1
d. *(x + n) is same as *x[n]
Answer  Explanation 

ANSWER: *(x + n) is same as &x[n]

Explanation:
No explanation is available for this question!


6)   C programming : State true of false.     

It is possible to pass a structure variable to a function either by value or by address.


a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
No explanation is available for this question!


7)   C++: A collection of generic class and function is called as

a. Standard Template Library (STL)
b. Header file
c. Function template.
d. None of the above.
Answer  Explanation 

ANSWER: Standard Template Library (STL)

Explanation:
No explanation is available for this question!


8)   C++: Which of the following is\are true about virtual function?

a. Function call is resolved at run-time
b. It is member function of a class.
c. Generally has a different functionality in the derived class.
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


9)   C++: The Standard Template Library (STL) consists of three main components. What are those components?

a. ADT, Structure,class.
b. Containers, Algorithms, and statements.
c. Containers, Algorithms, and Iterators.
d. None of the above.
Answer  Explanation 

ANSWER: Containers, Algorithms, and Iterators.

Explanation:
No explanation is available for this question!


10)   C++: What is RTTI?

a. Run-Time Type Identification (RTTI) is a technique that is used to know the type of any object at run time.
b. RTTI is a technique that is used to know the type of any object at compile time.
c. RTTI reserve memory of function at run time.
d. None of the above.
Answer  Explanation 

ANSWER: Run-Time Type Identification (RTTI) is a technique that is used to know the type of any object at run time.

Explanation:
No explanation is available for this question!


11)   C++: Trace the output

void execute (int x, int y = 200)
{
Int temp = x + y;

x +=temp;
if (y!= 200)
cout << temp << ”  ” << x << ”  ” << y << ”  ” << endl;
}
void main ( )
{

int a = 50, b = 20;
execute (b);
cout << a << ”  ” << b << ”  ” << endl;
execute (a, b);
}


a.
2202050
50 20
b.
50 20
70 120 20
c. 20 200
d. None of the above.
Answer  Explanation 

ANSWER:
50 20
70 120 20

Explanation:
No explanation is available for this question!


12)   C++: Which of the following is\are correct statements about inline function and macros.

a. Inline functions are parsed by the compiler but Macros are expanded by the C++ preprocessor.
b. Inline functions follow strict parameter type checking.
c. Macros do not follow parameter type checking.
d. All of the above.
Answer  Explanation 

ANSWER: All of the above.

Explanation:
No explanation is available for this question!


13)   Operating System: Which of the following scheduling policy is well suited for a time shared operating system?

a. First come first serve.
b. Shortest job first
c. Round robin
d. None of the above.
Answer  Explanation 

ANSWER: Round robin

Explanation:
No explanation is available for this question!


14)   Operating System: Which RAID level refers to disk mirroring?

a. 0
b. 1
c. 2
d. 3
Answer  Explanation 

ANSWER: 1

Explanation:
No explanation is available for this question!


15)   Operating System: Which one of the following is not a valid state of a thread?

a. running
b. destroying
c. ready
d. blocked
Answer  Explanation 

ANSWER: destroying

Explanation:
No explanation is available for this question!


16)   Operating System: The address generated by the CPU is referred to as:

a. physical address
b. logical address
c. physical as well as logical address.
d. None of the above.
Answer  Explanation 

ANSWER: logical address

Explanation:
No explanation is available for this question!


17)   Operating System: Which of the following scheduling algorithm is non-pre-emptive?

a. Multilevel feedback queue.
b. Round Robin
c. FIFO
d. None of the above.
Answer  Explanation 

ANSWER: FIFO

Explanation:
No explanation is available for this question!


18)   Operating System: The optimal page replacement algorithm will select the page that

a. has been used least number of times.
b. has been used most number of times.
c. has been used for the longest time in the past.
d. will not be used for the longest time in future.
Answer  Explanation 

ANSWER: will not be used for the longest time in future.

Explanation:
No explanation is available for this question!


19)   Data Structure: Which amongst the following cannot be a balance factor of any node of an AVL tree?

a. 0
b. 1
c. –1
d. 2
Answer  Explanation 

ANSWER: 2

Explanation:
No explanation is available for this question!


20)   Data Structure: A complete Binary Tree contains 15 nodes, then how many edges are there in the tree?

a. 15
b. 30
c. 14
d. 16
Answer  Explanation 

ANSWER: 14

Explanation:
No explanation is available for this question!


21)   Data Structure: Preorder and in order of a tree is give

Preorder ----- A B D H E C F I G J K
Inorder -------- D H B E A I F C J G K

What will be the postorder?


a. H D E B I F J K G C A
b. H D E B F I J K G C A
c. H D E B I F J K CG A
d. None of the above.
Answer  Explanation 

ANSWER: H D E B I F J K G C A

Explanation:
No explanation is available for this question!


22)   Data Structure: A complete binary tree with the property that key value in any node is greater than or equal to the key values in both its children is called as.

a. Binary search tree
b. Threaded binary tree
c. Heap
d. AVL tree
Answer  Explanation 

ANSWER: Heap

Explanation:
No explanation is available for this question!


23)   Data Structure: K4 and K3 are graphs with the following structure.



Which one of the following statements is TRUE in relation to these graphs?


a. K4 is planar while Q3 is not
b. Q3 is planar while K4 is not
c. Both K4 and Q3 are planar
d. Neither K4 nor Q3 is planar
Answer  Explanation 

ANSWER: Both K4 and Q3 are planar

Explanation:
No explanation is available for this question!


24)   Data Structure: What is the infix version of the following postfix expression?

x 12 + z 17 y + 42 * / +


a. x + 12 + z / 17 + y * 42
b. x + 12 + z / ((17 + y) * 42)
c. (x + 12 + z) / (17 + y * 42)
d. None of the above.
Answer  Explanation 

ANSWER: x + 12 + z / ((17 + y) * 42)

Explanation:
No explanation is available for this question!


25)   Networking: Why Piggybacking technique is used?

a. To take the backup of data packets.
b. To improve the efficiency of the unidirectional protocols.
c. To improve the efficiency of the bidirectional protocols.
d. None of the above.
Answer  Explanation 

ANSWER: To improve the efficiency of the bidirectional protocols.

Explanation:
No explanation is available for this question!


26)   Networking: Which of the following addresses is used to deliver a message to the correct application program running on a host?

a. Port
b. IP
c. Logical
d. Physical
Answer  Explanation 

ANSWER: Port

Explanation:
No explanation is available for this question!


27)   Networking: In classful addressing, the IP address 190.255.254.254 belongs to which class?

a. Class A
b. Class B
c. Class C
d. Class D
Answer  Explanation 

ANSWER: Class B

Explanation:
No explanation is available for this question!


28)   Networking: Match the following :

a. Data linklayer --------- i. Flowcontrol
b. Network layer --------- ii. Node tonodedelivery
c. Transport layer ------- iii. Mailservices
d. Application layer ----  iv. Routing


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

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

Explanation:
No explanation is available for this question!


29)   Networking: Which one of the following uses UDP as the transport protocol?

a. SMTP
b. HTTP
c. Telnet
d. DNS
Answer  Explanation 

ANSWER: DNS

Explanation:
No explanation is available for this question!


30)   Networking: The period of a signal is 10 ms. What is its frequency in Hertz?

a. 10
b. 100
c. 1000
d. 10000
Answer  Explanation 

ANSWER: 100

Explanation:
No explanation is available for this question!