1) (State True or False). The Java interpreter is used for
the execution of the source
code.
Options
True
False
Answer: True
2) What declarations
are required for every Java application?
Answer: A class and the main ( ) method declarations.
3) What are the two primary components involved in executing
a Java program and their
purposes?
Answer: Two parts in executing a Java program are:
Java Compiler and Java Interpreter.
4) What are the three basic OOPs principles and define them?
Answer: Encapsulation, Inheritance and Polymorphism are the
three OOPs Principles.
Encapsulation:
Is the Mechanism that binds together code and the data? It
manipulates, and keeps
both safe from outside interference and misuse.
Inheritance:
Is the process by which one object acquires the properties
of another object?
Polymorphism:
Is a feature that allows one interface to be used for a
general class of actions?
5) What are identifiers and what are their naming
conventions in C?Questions/Articles Extracted From www.CareersValley.com
Page 40
Answer: Identifiers are used for class names, method names
and variable names. An
identifier may be any descriptive sequence of upper case
& lower case letters, numbers
or underscore or dollar sign and must not begin with
numbers.
6) What is the return
type of program’s main ( ) method?
Answer: void
7) What is the use of
bin and lib in the JDK?
Answer: Bin contains all tools such as javac, applet viewer,
awt tool etc.,
whereas Lib contains all packages and variables.
8) The Java source code can be created in a Notepad editor.
Options
a) True
b) False
Answer: True
9) In C, arrays can be passed by reference. State True or
False.
Answer:
Yes, it is true; arrays are passed by reference (Though
individual or group of elements of
the array can be passed by value/values as well.)
10) Name the function which takes two strings as arguments
and copies the second
string into the character array of the first string. After
this the function returns the value of
the first string.
Answer: strcpy is the answer.
11) Blocks are chosen randomly on a chessboard. What is the
probability that they are
on the same diagonal?
Answer:
There are a total of 64 blocks on a chessboard. So 3 blocks
can be chosen Questions/Articles Extracted From www.CareersValley.com
Page 41
out of 64 in 64C3 ways.
So the sample space is = 41664
There are 2 diagonal on chessboard each one having 8 blocks. Consider one of
them. 3 blocks out of 8 blocks in diagonal can be chosen in
8C3 ways.
But there are 2 such diagonals, hence favourables = 2 * 8C3
= 2 * 56 =
112 the required probability is
= 112 / 1664
= 1 / 372
= 0.002688
12) What is the area of the triangle ABC with A (e, p) B
(2e, 3p) and C (3e, 5p)?
Where p = PI (3.141592654)
Answer:
A tricky ONE.
Given 3 points are collinear. Hence, it is a straight line.
Hence the area of a triangle is 0.
13) Silu and Meenu were walking on the road. Silu said,
"I weigh 51 Kgs. How much do
you weigh?" Meenu replied that she wouldn't reveal her
weight directly as she is
overweight. But she said, "I weigh 29 Kgs plus half of
my weight”. How much does
Meenu weigh?
Answer
Meenu weighs 58 Kgs.
It is given that Meenu weighs 29 Kgs plus half of her own
weight. It means that
29 Kgs is the other half. So she weighs 58 Kgs.
Solving mathematically, let's assume that her weight is X
Kgs.
X = 29 + X/2
2*X = 58 + X
X = 58 Kgs
14) Consider the sum: ABC + DEF + GHI = JJJ .If different
letters represent different Questions/Articles Extracted From
www.CareersValley.com
Page 42
digits, and there are no leading zeros, what does J
represent?
Answer :
The value of J must be 9.Since there are no leading zeros, J
must be 7, 8, or 9. (JJJ =
ABC + DEF + GHI= 14? + 25? + 36? = 7??)Now, the remainder
left after dividing any
number by 9 is the same as the remainder left after dividing
the sum of the digits of that
number by 9. Also, note that 0 + 1 + ... + 9 have a
remainder of 0 after dividing by 9 and
JJJ has a remainder of 0, 3, or 6. The number 9 is the only
number from 7, 8 and 9 that
leaves a remainder of 0, 3, or 6 if you remove it from the
sum 0 + 1 + ... + 9. Hence, it
follows that J must be 9.
15) Using two 2's and two 3's and using a maxim of three mathematical signs,
symbols, can you have a result in between 14 and 15?
Concatenation (clubbing of
digits) allowed.
Solution:
(23 + 3! ) / 2 =
14.5
16) a*b*c*d*e + b*c*d*e*f + a*c*d*e*f + a*b*d*e*f +
a*b*c*e*f + a*b*c*d*f = a*b*c*d*e*f
and a,b,c,d,e and f are all positive nonrepeating integers
then solve a,b,c,d,e, and f.
Solution:
Start with 1/2 + 1/2, then progressively split the last part
x into 2x/3 + x/3. This gives the
following progression:
2, 2
2, 3, 6
2, 3,9,18
2,3,9,27,54
2,3,9,27,81,162
17) 729 ml of a mixture contains milk and water in ratio
7:2. How much of the water is to
be added to get a new mixture containing half milk and half
water?
(i) 79 ml
(ii) 81 ml Questions/Articles
Extracted From www.CareersValley.com
Page 43
(iii) 72 ml
(iv) 91 ml
Solution:
Milk Quantity = (729 * (7/9)) =567ml
Water Quantity = (729-567) = 162ml
Let water to be added be x ml 567/(162+x) = 7/3 1701 = 1134
+ 7x x = 81ml
18) If one-seventh of a number exceeds its eleventh part by
100 then the number is…
(i) 770
(ii) 1100
(iii) 1825
(iv) 1925
Solution:
Let the number be x. Then X/7 - x/11 =100 11x-7x = 7700 x=1925.
19) If 1.5x=0.04y then the value of (y-x)/(y+x) is
(i) 730/77
(ii) 73/77
(iii) 7.3/77
(iv) None
Solution:
x/y = 0.04/1.5 = 2/75
So (y-x)/(y+x) = (1 - x/y)/(1 + x/y) = (1 - 2/75)/ (1 +
2/75) = 73/77.
20) The smallest number which when diminished by 3 is
divisible by 21, 28, 36 and 45
is...
(i) 869
(ii) 859
(iii) 4320
(iv) 1263
Solution: Questions/Articles Extracted From
www.CareersValley.com
Page 44
The required number = l.c.m. of (21, 28, 36 ,45)+3=1263
21) If x and y are the two digits f the number 653xy such
that this number is divisible by
80, then x+y is equal to:
(i) 2
(ii) 3
(iii) 4
(iv) 6
Solution:
80 = 2 x 5 x 10
Therefore, for 653xy to be divisible by 80, it has to be
divisible by 2,5 and 10 as well.
Since 653xy is divisible by 2 as well as by 5, so y = 0
Now 653x0 is divisible by 8 so 3x0 should also be divisible
by 8.
Only option which satisfies the above condition is x = 6.