Nielit Scientific Assistance IT 15-10-2017

Question 1
What will be the output of following?
main()
{
static int a=3;
printf("%d",a--);
if(a)
main();
}
A
3
B
3 2 1
C
3 3 3
D
Program will fall in continuous loop and print 3
Question 1 Explanation: 
The variable is static variable, the value is retained during multiple function calls. Initial value is 3
“A--” is post decrement so it will print “3”
if(2) condition is true and main() function will call again , Here the “a” value is 2.
“A--” is post decrement so it will print “2”
if(1) condition is true and main() function will call again Here the “a” value is 1.
“A--” is post decrement so it will print “1”
if(0) condition is false it won’t call main() function
Question 2
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a binary tree of height h is
A
2​ h
B
2​ h-1​ -1
C
2​ h+1​ -1
D
2​ h+1
Question 2 Explanation: 
● The number of nodes n in a full binary tree, is at least n = 2 h + 1 and at most n = 2 h+1 − 1 , where h is the height of the tree. A tree consisting of only a root node has a height of 0.
● The number of leaf nodes l in a perfect binary tree, is l = ( n + 1 )/2 because the number of non-leaf (a.k.a. internal) nodes

● This means that a perfect binary tree with l leaves has n = 2 l − 1 nodes. ● In a balanced full binary tree, h = ⎡ log 2 (l)⎤ + 1 = ⎡ log 2 ((n + 1 )/2)⎤ + 1 = ⎡ log 2 (n + 1 )⎤
● In a perfect full binary tree, l = 2 h thus n = 2 h+1 − 1
● The maximum possible number of null links (i.e., absent children of the nodes) in a complete binary tree of n nodes is ( n + 1 ) , where only 1 node exists in bottom-most level to the far left.
●The number of internal nodes in a complete binary tree of n nodes is ⎣ n/2⎦ .
Question 3
​ Web links are stored within the page itself and when you wish to 'jump' to the page that is linked, we select the hotspot or anchor. This technique is called
A
Hypertext
B
hypermedia
C
Both (A) and (B)
D
Anchoring
Question 3 Explanation: 
Web links are stored within the page itself and when you wish to 'jump' to the page that is linked, we select the hotspot or anchor. This technique is called hypertext or hypermedia.
Question 4
If the objects focus on the problem domain, then we are concerned with
A
Object Oriented Analysis
B
Object Oriented Design
C
Object Oriented Analysis and design
D
None of the above
Question 4 Explanation: 
→ The purpose of any analysis activity in the software life cycle is to create a model of the system's functional requirements that is independent of implementation constraints.
→ The main difference between object-oriented analysis and other forms of analysis is that by the object-oriented approach we organize requirements around objects, which integrate both behaviors (processes) and states (data) modeled after real world objects that the system interacts with. In other or traditional analysis methodologies, the two aspects: processes and data are considered separately.
→ For example, data may be modeled by ER diagrams, and behaviors by flow charts or structure charts.
Question 5
Which of the following is not a form of main memory?
A
Instruction cache
B
Instruction register
C
Instruction Opcode
D
Translation lookaside buffer
Question 5 Explanation: 
In computing, an opcode (abbreviated from operation code, also known as instruction syllable, instruction parcel or opstring) is the portion of a machine language instruction that specifies the operation to be performed. Beside the opcode itself, most instructions also specify the data they will process, in the form of operands. In addition to opcodes used in the instruction set architectures of various CPUs, which are hardware devices, they can also be used in abstract computing machines as part of their byte code specifications.
Note: Instruction opcode not in a form of main memory.
Question 6
which of the following is useful in traversing a given graph by breadth first search?
A
Stack
B
Set
C
List
D
Queue
Question 6 Explanation: 
Queue can be generally thought as horizontal in structure i.e, breadth/width can be attributed to it - BFS, whereas Stack is visualized as a vertical structure and hence has depth - DFS.
Question 7
M is a square matrix of order 'n' and its determinant value is 5, If all the elements of M are multiplied by 2, its determinant value becomes 40. he value of 'n' is
A
2
B
3
C
5
D
4
Question 7 Explanation: 
M has n rows. If all the elements of a row are multiplied by , the determinant value becomes 2*5. Multiplying all the n rows by 2, will make the determinant value 2​ n ​ *5=40. Solving n= 3.
Question 8
Is null an object?
A
yes
B
No
C
Sometimes yes
D
None of these
Question 8 Explanation: 
If null were an Object, it would support the methods of java.lang.Object such as equals().
However, this is not the case - any method invocation on a null results in a NullPointerException.
There is also a special null type, the type of the expression null, which has no name. Because the null type has no name, it is impossible to declare a variable of the null type or to cast to the null type. The null reference is the only possible value of an expression of null type. The null reference can always be cast to any reference type. In practice, the programmer can ignore the null type and just pretend that null is merely a special literal that can be of any reference type
Question 9
Which of the following scheduling algorithm could result in starvation?
A
Priority
B
Round Robin
C
FCFS
D
none of the above
Question 9 Explanation: 
Priority scheduling algorithm could result starvation. Starvation is nothing but indefinite blocking.
Question 10
Which of the following is a desirable property of module?
A
Independency
B
low cohesiveness
C
High coupling
D
Multifunctional
Question 10 Explanation: 
The goal of software engineering is high cohesion and low coupling. The desirable property of module is independency.
Question 11
Which of these events will be generated if we close an applet's window?
A
ActionEvent
B
ComponentEvent
C
AdjustmentEvent
D
WindowEvent
Question 11 Explanation: 
A low level event that indicates that a window has changed its status. This low-level event is generated by a Window object when it is opened, closed, activated, deactivated, iconified, or deiconified, or when focus is transferred into or out of the Window.
Question 12
If queue is implemented using arrays, what would be the worst run time complexity of queue and dequeue operations?
A
O(n), O(n)
B
O(n), O(1)
C
O(1), O(n)
D
O(1), O(1)
Question 12 Explanation: 
Everyone thought that answer in worst case time is O(n) for both the cases but using circular queue, we can implement in constant amount of time.
Question 13
The following program fragment prints
int i=5;
do
{
putchar(i+100);
printf("%d",i--);
}
while(i);
A
i5h4g3f2el
B
14h3g2f1e0
C
An error message
D
None of the above
Question 13 Explanation: 
Here, i=5 and putchar(i+100) it means actually putchar(5+100) ⇒ putchar(105);
It will print the ASCII equivalent of 105 which is lower case ' i '. The printf statement prints the current value of i. i.e. 5 and then decrements it. So, h4 will be printed in the next pass. This continues until ' i ' becomes 0, at which point the loop gets terminated.
Question 14
The running time of an algorithm T(n),where 'n' is the input size, is given by
T(n)=8T(n/2)+qn, if n>1
=p, if n=1
Where p,q are constants. The order of this algorithm is
A
n2
B
nn
C
n3
D
N
Question 14 Explanation: 
Apply master theorem.
a=8,b=2,k=0,p=0;
So, according to masters theorem, a>b​ k
=O(n^log​ 2​ 8​ )
=O(n​ 3​ )
Question 15
Consider a system having 'm' resources of the same type. these resources are shared by 3 processes A,B,C; which have peak time demands of 3,4,6 respectively. The minimum value of 'm' that ensures that deadlock will never occur is
A
11
B
12
C
13
D
14
Question 15 Explanation: 
A requires 3, B-4, C-6;
→ If A have 2, B have 3, C have 5 then deadlock will occur i.e., 2+3+5=10.
→ If we have one extra resource then deadlock will not occur i.e., 10+1=11.
→ If we have equal (or) more than 11 resources then deadlock will never occur.
There are 15 questions to complete.

Access quiz wise question and answers by becoming as a solutions adda PRO SUBSCRIBER with Ad-Free content

Register Now

If you have registered and made your payment please contact solutionsadda.in@gmail.com to get access

Scientific Assistance CS 15-10-2017

Question 1
The difference between the compound interest and the simple earned at the end of 3​ rd​ year on a sum of money at a rate of 10% per annul is Rs. 77.5. What is the sum?
A
Rs. 3,500
B
Rs. 2,500
C
Rs. 3,000
D
Rs. 2,000
Question 1 Explanation: 
Let principal be ‘x’
S.I = P T R / 100
S.I = X * 3 * 10 / 100
C.I = [ P (1 + (R / 100)T) - P]
C.I = [ X (1+ (10 / 100)3) - X]
C.I = 331X / 1000
Difference between Compound interest and Simple interest is 77.5
( 331X / 1000 ) - ( 3X / 10) = 77.5
31x / 1000 = 77.5
x = 2500.
Question 2
Aamir and Birju can cut 5000g of wood in 20 min. Birju and Charles can cut 5000g of wood in 40 min. Charles and Aamir cut 5 kg of wood in 30 min. How much time Charles will take to cut 5 kg wood alone?
A
120 min
B
48 min
C
240 min
D
120 min
Question 2 Explanation: 
Here in this question 5000g means 5kg only
So from that question Aamir (A) Birju (B) Charles (C)
Let Aamir, Birju and Charles alone can complete the work in A, B and C minutes respectively, then
1 min. work of (A+B)=1/20, (B+C)=1/40 and (C+A)=1/30
A + B + C = 13/240
1 min. work of C = (A+B+C) - (A+B) = 13/240 - 1/20 = 1/240
So C alone can complete the work in 240 min.
Question 3
An alloy contains copper and zinc in the ratio 5 : 3 and another contains copper and tin in the ratio 8 : 5, If equal weights of the two are melted together to form a 3​ rd​ alloy, find the weight of tin per kg in the new alloy.
A