July 17, 2021 in C and CPP
What is Garbage Collection? List the techniques to facilitate garbage collection.
a) What is Garbage Collection? List the techniques to facilitate garbage collection.
July 17, 2021 in C and CPP
a) What is Garbage Collection? List the techniques to facilitate garbage collection.
July 17, 2021 in C and CPP
A. Byte code B. package C. JAR (Java Archive)
D. ASCII E. arrays F. import
G. private H. polymorphic I. CASE tool
J. Inheritance K. Interoperability L. heap
M. Protected
4.1 A ________ operation has same name but uses different methods depending on class.
4.2 ________ verifier confirms that all security and portability are valid and do not violate Java’s security restrictions.
4.3 Storage for objects is allocated in a designated part of the memory called the ________ which has a finite size.
4.4 ________ is defined as cooperation between object codes produced by different software
vendors and written in different programming languages.
4.5 A(n) ________ declaration is not required if you always refer to a class with its fully qualified class name.
4.6 In Java, ________ are objects.
4.7 Once algorithms are finalized, we convert them into a program using OOPL or using ________.
4.8 A ________ in Java is an encapsulation mechanism that can be used to group related classes, interfaces, enums, and sub packages.
4.9 The ________ utility provides a convenient way of bundling and deploying Java programs.
4.10 ________ in object-oriented modelling can be used to generalize and to specialize classes.
July 17, 2021 in C and CPP
Each statement below is either TRUE or FALSE. Choose the most appropriate one and
ENTER in the “tear-off” sheet attached to the question paper, following instructions
therein.
2.1 Objects selected to model a system must have all attributes which are invariant during
operations of a system.
2.2 Use cases are not beneficial for all interface requirements.
2.3 Java considers the variables number and NuMbEr to be identical.
2.4 An instance member belongs to an instance, not to the class as a whole.
2.5 If the references x and y denote two different objects, the expression x.equals(y) is always false.
2.6 Subclasses of the String class can be mutable.
2.7 A local variable in a block cannot be redeclared in another block even if the blocks are disjoint.
2.8 If an exception is thrown during the execution of the finalize() method of an eligible object, the exception is ignored and the object is destroyed.
2.9 A constructor can be declared private.
2.10 The import declarations must be the first statement after any package declaration in a source file.
July 17, 2021 in C and CPP
1.10 What will be the result of compiling and running the following program?
public class NewClass2 {
public static void main(String[] args) {
NewClass2 obj = new NewClass2(n);
}
static int i = 5;
static int n;
int j = 7;
int k;
public NewClass2(int m) {
System.out.println(i + ", " + j + ", " + k + ", " + n + ", " + m);
}
{
j = 70;
n = 20;
} // Instance Initializer Block
static {
i = 50;
} // Static Initializer Block
}
A) The code will fail to compile because the instance initializer block tries to assign a value to a static field.
B) The code will fail to compile because the field k will be uninitialized when it is used.
C) The code will compile and print 50, 70, 0, 20, 0 when run.
D) The code will compile and print 50, 70, 0, 20, 20 when run.
July 17, 2021 in C and CPP
1.9 Which of the following is not reserved keyword?
A) public
B) static
C) void
D) main
July 17, 2021 in C and CPP
1.8 Given that the name of the class MyClass is specified correctly, which commands are
syntactically valid.
A) Java -Ddebug=true MyClass
B) Java -ddebug=true MyClass
C) Java -Ddebug="true" MyClass
D) Java -D debug=true MyClass
July 17, 2021 in C and CPP
1.7 In object-oriented design
A) operations and methods are identical
B) methods do not change values of attributes
C) methods and constructor are same
D) methods specify algorithms, whereas operations only state what is to be done
July 17, 2021 in C and CPP
1.6 What is the return type of the hashCode() method in the Object class?
A) String
B) integer
C) long
D) Object
July 17, 2021 in C and CPP
1.5 What will be the result of attempting to compile and run the following program?
public class MyClass {
public static void main(String[] args) {
String s = "hello";
StringBuilder sb = new StringBuilder(s);
sb.reverse();
if (s == sb) {
System.out.println("a");
}
if (s.equals(sb)) {
System.out.println("b");
}
if (sb.equals(s)) {
System.out.println("c");
}
}
}
A) The code will fail to compile because the constructor of the String class is not called properly.
B) The code will fail to compile because the expression (s == sb) is illegal.
C) The code will fail to compile because the expression (s.equals(sb)) is illegal.
D) The program will print c, when run.
July 17, 2021 in C and CPP
1.4 Encapsulation in object-oriented modelling is useful as
A) it allows improving methods of an object independent of other parts of a system
B) it hides implementation details of methods
C) it allows easy designing
D) encapsulates attributes and operations of object