Explanation: Stack concept is used in towers of hanoi
Explanation:
All deadlocks involve conflicting resource needs by two or more processes. Here graph contains cycle which involves only a set of resource types each of which has only a single instance. Then here deadlock might occur.
Explanation: If public access specifier is used for a method it can be accessed in different parts of the program.
Explanation: The binary equivalent of 21 is 10101.
Explanation: A program without main function will not do anything, it will only produce a blank screen. Execution of program starts from the main function.
A. 2n+1 nodes
B. log2n nodes
C. 2n—1 nodes
D. 2n nodes
Explanation: Full binary tree with n leaves contain 2n – 1 nodes.
A. Public
B. Private
C. Private and Protected
D. Protected
Explanation: A subclass does not inherit the private members of its parent class
A.Bubble sort
B.Insertion sort
C.Selection sort
D.Heap sort
Explanation: In insertion sort values from the unsorted part are picked and placed at the correct position in the sorted part. So it is the best way for a librarian.
What is the efficient way to debug the code?
A. Compile the entire code and check it line by line
B. Use an interpreter on the first 25 lines of code
C. Compile the entire code and run it
D. None of the above can be used to debug the code
Explanation: Here it is mentioned that there is a logical error in the first 25 lines of code. So the best way to debug the code is to use an interpreter on the first 25 lines.
(Note: Assume that when two data types are processed through an operator, the answer maintains the same data type as that of the input. Also, all data types have enough range to accommodate any number. If two different data types are operated upon, the result assumes the data type that is more expressive.)
integer a = 984, b=10
//float is a data type to store real numbers.
float c
c = a/b
print c
A.984
B.98.4
C.98
D.Error
Explanation: Here a and b are integers, so when 984/10 is done only 98 will be stored in variable c which is float(actually it is 98.000000). So answer is 98.
A.7
B.35
C.28
D.196
Explanation: In binary, there are only two possibilities- zero and one.
Thus, looking at the powers of 2, we realize that 32 is the closest exponential result of 2 to 28, where 2^5 = 32.
Hence, to cover all the possibilities, we need 5 bits at the least.
But there are seven letters. Thus, the number of bits we require is 7 * 5 = 35 bits
X writes the code (Code A) as follows:
for n= 0 to 1
sumRow1[n]=A[n][0]+A[n][1]
end
Y writes the code (Code B) as follows:
sumRow1[0] =A[0][0] + A[0][1]
sumRow1[1] =A[1][0] + A[1][1]
Which of the following statements is correct about these codes if no loop unrolling is done by the compiler?
A.Code A would execute faster the Code B
B.Code B would execute faster than Code A
C.Code B is logically incorrect
D.Code A is logically incorrect
Explanation: A technique for transforming loops called "loop unrolling" aids in streamlining a program's execution time. Iterations are essentially eliminated or decreased. When a loop is unrolled, loop control and loop test instructions are removed, which speeds up the programme. In Code B the number of overhead Looping is more than Code A. So code B will be faster than code A.
A.Radix search
B.Breath first search
C.Recursion
D.None of the above
Explanation: For executing recursion we stack implementation is useful.