7 Hacks to become a better Java problem-solver | TechGig
https://content.techgig.com/7-hacks-to-become-a-better-java-problem-solver/articleshow/79468180.cms
https://content.techgig.com/7-hacks-to-become-a-better-java-problem-solver/articleshow/79468180.cms
TechGig
7 Hacks to become a better Java problem-solver
By Kajal Garg For a Java developer, transforming into a professional programmer is not that tricky and the most expected quality to become one is to detect
What is byte code in the context of Java?
Anonymous Quiz
43%
The type of code generated by a Java compiler.
40%
The type of code generated by a Java Virtual Machine.
10%
It is another name for a Java source file.
7%
It is the code written within the instance methods of a class.
0%
It is another name for comments written within a program.
What is garbage collection in the context of Java?
Anonymous Quiz
7%
The operating system periodically deletes all the java files available on the system.
23%
Any package imported in a program and not used is automatically deleted.
60%
When all references to an object are gone the memory used by the object is automatically reclaimed
10%
The JVM checks the output of any Java program and deletes anything that doesn't make sense.
You read the following statement in a Java program that compiles and executes.
submarine.dive(depth);
What can you say for sure?
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()
The correct order of the declarations in a Java program is,
Anonymous Quiz
59%
Package declaration, import statement, class declaration
19%
Import statement, package declaration, class declaration
15%
Import statement, class declaration, package declaration
7%
Class declaration, import statement, package declaration
0%
Class declaration, package declaration, import statement
An overloaded method consists of,
Anonymous Quiz
19%
(a) The same method name with different types of parameters
19%
(b) The same method name with different number of parameters
16%
(c) The same method name and same number and type of parameters with different return type
39%
(d) Both (a) and (b) above
6%
(e) (a), (b) and (c) above.
A protected member can be accessed in,
Anonymous Quiz
23%
a subclass of the same package
13%
a non-subclass of the same package
16%
a non-subclass of different package
23%
a subclass of different package
26%
the same class.
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); } }
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
method defined by the
Anonymous Quiz
33%
Super class
53%
Subclass
13%
Compiler will choose randomly
0%
Interpreter will choose randomly
Mark the incorrect statement from the following:
Anonymous Quiz
29%
Java is fully object oriented language with strong support for proper software engineering technique
6%
In java it is not easy to write C-like so called procedural programs
16%
In java language objects have to be manipulated
13%
In java language error processing is built into the language
35%
Java is not a language for internet programming.
In java, objects are passed as
Anonymous Quiz
28%
Copy of that object
28%
Method called call by value
17%
Memory address
3%
Default constructor.
25%
Constructor
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++.
Identify, from among the following, the incorrect variable name(s).
Anonymous Quiz
4%
_theButton
23%
$reallyBigNumber
54%
2ndName
12%
CurrentWeatherStateofplanet
8%
my2ndFont
Consider the following Java program :
class IfStatement{
public static void main(String args[])
{
int a=2, b=3;
if (a==3)
if (b==3)
System.out.println("===============");
else
System.out.println("#################");
System.out.println("&&&&&&&&&&&");
}
}
Which of the following will the output be?
(a) ===============
(b) #################
&&&&&&&&&
(c) &&&&&&&&&&&
(d) ===============
#################
&&&&&&&&&&
(e) ################
class IfStatement{
public static void main(String args[])
{
int a=2, b=3;
if (a==3)
if (b==3)
System.out.println("===============");
else
System.out.println("#################");
System.out.println("&&&&&&&&&&&");
}
}
Which of the following will the output be?
(a) ===============
(b) #################
&&&&&&&&&
(c) &&&&&&&&&&&
(d) ===============
#################
&&&&&&&&&&
(e) ################
In operating system which of the following statement best describes the dispatch latency element that is available in time sharing systems?
Anonymous Quiz
16%
Time taken to switch from one thread to another thread
26%
Time taken to swap the process
26%
Time taken to submit and complete the process
32%
Time taken to terminate the process and initiate another process
In operating system which of the following statements about preemptive scheduling is correct
1)Resources are allocated to a process for a limited period
2)Processes cannot be interrupted until they are terminated
3)Overhead are not available in a process
4) Low Priority processes can starve
1)Resources are allocated to a process for a limited period
2)Processes cannot be interrupted until they are terminated
3)Overhead are not available in a process
4) Low Priority processes can starve