JAVA
2.7K subscribers
73 photos
111 files
76 links
Download Telegram
Which of the following variable declaration would NOT compile in a java program?
Anonymous Quiz
0%
int var;
4%
int VAR;
8%
int var1;
4%
int var_1;
85%
int 1_var;
Consider the following class definition:
public class MyClass
{
private int value;
public void setValue(int i){ /* code */ }
// Other methods...
}
The method setValue assigns the value of i to the instance field value. What could you write for the
implementation of setValue?
(a) value = i;
(b) this.value = i;
(c) value == i;
(d) Both (A) and (B) and above
(e) (A), (B) and (C) above.
Options
Anonymous Quiz
13%
A
31%
B
13%
C
44%
D
0%
E
You read the following statement in a Java program that compiles and executes.
submarine.dive(depth);
What can you say for sure?
Anonymous Quiz
0%
depth must be an int
23%
dive must be a method.
32%
dive must be the name of an instance field.
36%
submarine must be the name of a class
9%
submarine must be a method.
The java run time system automatically calls this method while garbage collection.
Anonymous Quiz
9%
finalizer()
55%
finalize()
24%
finally()
12%
finalized()
What is the output of the following code:
class eq
{ public static void main(String args[]) { String s1 = “Hello”; String s2 = new String(s1); System.out.println(s1==s2); } }
Anonymous Quiz
35%
true
53%
false
12%
0
0%
1
All exception types are subclasses of the built-in class
Anonymous Quiz
31%
Exception
23%
RuntimeException
6%
Error
40%
Throwable
When an overridden method is called from within a subclass, it will always refer to the version of that
method defined by the
Anonymous Quiz
33%
Super class
53%
Subclass
13%
Compiler will choose randomly
0%
Interpreter will choose randomly
Which of the following is not a component of Java Integrated Development Environment (IDE)?
Anonymous Quiz
14%
Net Beans
29%
Borland’s Jbuilder
25%
Symantec’s Visual Café
14%
Microsoft Visual Fox Pro
18%
Microsoft Visual J++.