6
Q:

void waitForSignal() {

Object obj = new Object();

synchronized (Thread.currentThread()) {

obj.wait();

obj.notify();

}

}

Which statement is true?

A) This code can throw an InterruptedException. B) This code can throw an IllegalMonitorStateException.
C) This code can throw a TimeoutException after ten minutes D) All the above

Answer:   B) This code can throw an IllegalMonitorStateException.



Explanation:

It will throw  IllegalMonitorStateException.

Subject: Java
Job Role: IT Trainer
Q:

Which of the following attribute can hold the JavaScript version?

A) script B) version
C) language D) none of the above
 
Answer & Explanation Answer: C) language

Explanation:

Language attribute contains the javascript versions.

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: Analyst , IT Trainer , Software Architect

9 15966
Q:

Which of the following best describes JavaScript?

A) a scripting language precompiled in the browser. B) an object-oriented scripting language
C) a low-level programming language. D) a compiled scripting language.
 
Answer & Explanation Answer: B) an object-oriented scripting language

Explanation:

JavaScript, often abbreviated as JS, is a high-level, interpreted programming language that conforms to the ECMAScript specification.

 

JavaScript has

* curly-bracket syntax,

* dynamic typing,

* prototype-based object-orientation, and

* first-class functions.

 

Uses :

It is well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: IT Trainer

3 15261
Q:

Javascript is interpreted by

A) Server B) Object
C) Client D) None of the above
 
Answer & Explanation Answer: C) Client

Explanation:

JavaScript is an interpreted language, not a compiled language. A program such as C++ or Java needs to be compiled before it is run.

The source code is passed through a program called a compiler, which translates it into bytecode that the machine understands and can execute.

Report Error

View Answer Report Error Discuss

Filed Under: Java
Job Role: Analyst , IT Trainer

21 26150
Q:

Which is a reserved word in the java programming language?

A) Variable B) Identifier
C) Keyword D) Main
 
Answer & Explanation Answer: C) Keyword

Explanation:

Reserved words are words that cannot be used as object or variable names in a Java program because they're already used by the syntax of the Java programming language.

Java reserved words are keywords that are reserved by Java functions or other uses that cannot be used as identifiers (e.g., variable names, function names, class names).

If a reserved word was used as a variable you would get an error or unexpected result.

 

Examples : Int, Long, Abstract, Class, Break, Catch, Case, Public, Static, Void,...

 

 

Report Error

View Answer Report Error Discuss

1 2169
Q:

Difference between Arraylist and Linked list?

Answer

ArrayList and LinkedList both implements List interface and maintains insertion order. Both are non synchronized classes.


 


But there are many differences between ArrayList and LinkedList classes that are given below.


 

ArrayList    V/s     LinkedList ::


 

1) ArrayList internally uses dynamic array to store the elements.


                   Whereas


LinkedList internally uses doubly linked list to store the elements.


 

2) Manipulation with ArrayList is slow because it internally uses array. If any element is removed from the array, all the bits are shifted in memory.


                   Whereas


Manipulation with LinkedList is faster than ArrayList because it uses doubly linked list so no bit shifting is required in memory.


 

3) ArrayList class can act as a list only because it implements List only.


                   Whereas


LinkedList class can act as a list and queue both because it implements List and Deque interfaces.


 

4) ArrayList is better for storing and accessing data.


                   Whereas


LinkedList is better for manipulating data.

Report Error

View answer Workspace Report Error Discuss

3 2293
Q:

What is String Args in Java?

Answer

String Args (String []) is an array of parameters of type String.


In Java, 'args' contains the supplied command-line arguments as an array of String objects. In other words, if you run your program as 'java MyProgram Hello World' then 'args' will contain ["Hello", "World"]. When a java class is executed from the console, the main method is what is called.

Report Error

View answer Workspace Report Error Discuss

9 2192
Q:

What is Interpreter in Java?

Answer

  • An Interpreter is a program that reads in as input a source program, along with data for the program, and translates the source program step by step.


 


The Java interpreter decodes each lines bytecode and runs a series of machine instructions for that bytecode. The JVM takes the byte code and generates machine code. The byte code is compiled to machine code, and the machine code is executed.

Report Error

View answer Workspace Report Error Discuss

7 2569
Q:

When do you override hashcode and equals() ?

Answer

HashCode method return int value. So the Hash value is the int value returned by the hash function .


If you want to do equality check or want to use your object as key in HashMap, we must override hashcode and equals() method.

Report Error

View answer Workspace Report Error Discuss

Subject: Java
Job Role: Analyst , IT Trainer

5 3014