Continuous Assessment - 1
Continuous Assessment - 1
class IncOp {
public static void main(String[] args) {
int g = 3;
System.out.print(++g * 8);
}
}
a. 32
b. 33
c. 24
d. 25
class VarScope {
public static void main(String[] args) {
int x = 5;
{
int y = 6;
System.out.print(x + “ “ + y);
}
System.out.println(x + “ “ + y);
}
}
a. Compilation Error
b. Run Time Error
c. 5 6 5 6
d. 5 6 5
3. What will be the Output of the following Code?
class Array {
public static void main(String[] args) {
int[] arr = new int[5];
a. 1 2 3 4 5
b. 1 2 3 4
c. 1 2
d. 1 2 3
class CmdArgTest {
public static void main(String[] args) {
if(args.length > 0)
System.out.print(args.length);
}
}
a. break
b. continue
c. for()
d. if()
class RecursionTest {
int fun(int n) {
int result;
if(n == 1)
return 1;
class Output {
public static void main(String[] args) {
RecursionTest rec_t = new RecursionTest();
System.out.print(rec_t.fun(7));
}
}
a. 28
b. 1
c. 5040
d. None of these
a. static
b. constant
c. protected
d. final
10. Which Keyword is used to restrict the variable of a Class from inheriting to Child Class?
a. protected
b. private
c. public
d. static
class VarDeclare {
public static void main(String[] args) {
int z = 8;
if(z == 8) {
int z = 5;
System.out.println(z);
}
}
}
a. 5
b. 8
c. Compile Time Error
d. Run Time Error
a. private
b. public
c. protected
d. default
14. Which of the following Access means that a Variable is not accessible, even within the
Package?
a. private
b. public
c. default
d. protected
15. How many copies of Static variables and Class variables are created, when 10 Objects of a
Class are initialized?
a. 10, 10
b. 10, 1
c. 1, 10
d. 1, 1
16. Which data structure is used to handle Recursion?
a. Queue
b. Stack
c. Tree
d. Array
class Compute {
public static void main(String[] args) {
double v1 = 1 + 7;
double v2 = v1 / 5;
int b3 = 1 + 7;
int b4 = b3 / 5;
System.out.print(v2 + “ “ + b4);
}
}
a. 1 1
b. 0 1
c. 1.6 1
d. 1.6 1.0
class Operate {
public static void main(String[] args) {
int a = 1, b = 2, c, d;
c = ++b;
d = a++;
c++;
b++;
++a;
System.out.println(a + “ “ + b + “ “ + c);
}
}
a. 3 2 4
b. 3 2 3
c. 2 3 4
d. 3 4 4
19. The order of Constructor Call in Multi Level Inheritance is from _____ to _____; while the
order of Destructor Call is from _____ to _____.
20. A Base Class can have multiple Child Classes; this is possible in _____ Inheritance.
a. Multi Level
b. Hierarchical
c. Simple
d. All of these