Web Tech./DS/OS/Java/Oracle/C++ Test Set 2

1)   Algorithms: From the following algorithm design techniques which one is used to find all the pairs of shortest distances in a graph?

a. Backtracking
b. Greedy
c. Dynamic programming
d. Divide
Answer  Explanation 

ANSWER: Dynamic programming

Explanation:
The Bellman-Ford algorithm is used to find all the pairs of shortest distances in a graph.


2)   Algorithms: Consider a B-tree of order 4 and is built from scratch by 10 successive insertions. What would be the maximum number of node splitting operations that take place?

a. 6
b. 3
c. 4
d. 2
Answer  Explanation 

ANSWER: 4

Explanation:
A B-tree of order m contains n records and each contains b records on average then the tree will have about n/b leaves. If we split k nodes along the path from leaves then
k<=1+logm/2 [n/b]
here n=10,b=3,m=4 so
k<=1+log4/2 [n/b]
k<=1+log2 4
k<= 1+2
k<=3


3)   Algorithms: What will be the Huffman code for the letters a,b,c,d,e?

a. 0,10,110,1110,1111
b. 10,011,11,001,010
c. 10,01,0001,100,1010
d. 100,110,001,000,010
Answer  Explanation 

ANSWER: 0,10,110,1110,1111

Explanation:
The probability are ½,1/4, 1/8,1/16,,1/32
So, the Huffman code according to the tree is unique.


4)   Java language was initially called as 'Oak'

a. True
b. False


Answer  Explanation 

ANSWER: True

Explanation:
Oak was a language created by James Gosling which was created for Sun Micro systems for the set top box project. It was named as Oak by Gosling after an Oak tree which stood outside the office.


5)   Java: Which provides a new way for your programs to interface with code libraries written in other languages?

a. JNI
b. JDBC
c. RMI
d. GUI
Answer  Explanation 

ANSWER: JNI

Explanation:
Java Native Interface(JNI) is a programming framework that enables the java code running in a JVM to call and be called by native applications.


6)   Java: In this type one super-class is having more than one sub-class?

a. Hierarchical inheritance
b. Single inheritance
c. Multiple inheritances
d. Multilevel inheritance
Answer  Explanation 

ANSWER: Hierarchical inheritance

Explanation:
Hierarchical inheritance is when a class has more than one sub classes (child classes)


7)   Which is used for Java Virtual Machine "assembly language", its opcodes and operands, as well as items in the Java Virtual Machine's run-time data areas?

a. ASCII
b. Italic
c. Latin
d. Greek
Answer  Explanation 

ANSWER: Italic

Explanation:
No explanation is available for this question!


8)   Java Virtual Machine is platform independent?

a. True
b. False


Answer  Explanation 

ANSWER: False

Explanation:
The JVM depends on the operating system. If we go and see the list of corresponding JVM we can find that different operating system have different JVM.


9)   Which specification that provides runtime environment in which java byte code can be executed?

a. JDK
b. JVM
c. JRE
d. None of the above
Answer  Explanation 

ANSWER: JVM

Explanation:
The JVM interprets the compiled java code for a computers processor so that it can perform the java programs instructions


10)   Java: The comment must begin with /* and end with */ is known as?

a. Multiline comment
b. Single line comment
c. Both A & B
d. None of the above
Answer  Explanation 

ANSWER: Multiline comment

Explanation:
A multiline comment is used when we need various lines to comment in a program. We use this /* to start a comment and */ to end a comment.


11)   C++: When a copy of an entire object is passed to a function, then it is referred to as

a. Pass-by-reference
b. Pass-by-pointer
c. Pass-by-value
d. None of the above
Answer  Explanation 

ANSWER: Pass-by-value

Explanation:
The pass-by-value passes arguments to a function copies the actual value of an argument into a formal parameter of a function.


12)   C++: The keyword used to transfer control from a function back to the calling function is

a. switch
b. goto
c. go back
d. return
Answer  Explanation 

ANSWER: return

Explanation:
The return statement terminates the execution of a function and it returns the control to the calling function. The execution resumes in the calling function at a point immediately following the call.


13)   C++: Which of the following can not be used as identifiers?

a. Lettersscope resolution operator in c++
b. Digits
c. Underscores
d. Spaces
Answer  Explanation 

ANSWER: Spaces

Explanation:
No explanation is available for this question!


14)   C++: A constructor

a. Constructs new data type
b. Enables the initialization of an object as it is created
c. Obtain memory for a new variable
d. None of the above
Answer  Explanation 

ANSWER: Enables the initialization of an object as it is created

Explanation:
Enables the initialization of an object as it is created
Explanation: Constructors are special class functions which performs on initialization of every object. It has the same name as the class name


15)   C++: What does C++ append to the end of a string literal constant?

a. a space
b. a number sign (#)
c. an asterisk (*)
d. a null character
Answer  Explanation 

ANSWER: a null character

Explanation:
a null character string is a char array with a null value (0x00) after the last valid character in the string.


16)   Networking: Communication circuits that transmit data in both directions but not at the same time are operating in

a. a simplex mode
b. a half duplex mode
c. a full duplex mode
d. an asynchronous mode
Answer  Explanation 

ANSWER: a half duplex mode

Explanation:
In a half duplex mode the communication happens once at a time.


17)   Networking: Print server uses ________ which is a buffer that holds data before it is sent to the printer.

a. Queue
b. Spool
c. Node
d. Stack
Answer  Explanation 

ANSWER: Spool

Explanation:
Spool is a type of buffering. Print server is the best example for spool.


18)   Networking: Frames from one LAN can be transmitted to another LAN via the device

a. Router
b. Bridge
c. repeater
d. Modem
Answer  Explanation 

ANSWER: Bridge

Explanation:
A bridge is a network device which connects multiple network segments.


19)   Networking: You want to implement a mechanism that automates the IP configuration, including IP address, subnet mask, default gateway, and DNS information. Which protocol will you use to accomplish this?

a. SMTP
b. SMNP
c. DHCP
d. ARP
Answer  Explanation 

ANSWER: DHCP

Explanation:
The Dynamic Host Configuration Protocol is a client/server protocol which automatically provides an Internet Protocol.


20)   Networking : The loss in signal power as light travels down the fiber is called

a. attenuation
b. progragation
c. scattering
d. interruption
Answer  Explanation 

ANSWER: attenuation

Explanation:
Attenuation refers to any reduction in the strength of a signal. It occurs with any type of signal, whether digital or analog. It is a natural consequence of signal transmission over long distances.