Set 13

Multiple Choice Question

QID: 
322

Consider the following lines of code:
   System.out.println(null + true); //1
   System.out.println(true + null); //2
   System.out.println(null + null); //3

Which of the following statements are correct?

Select 1 option

A. None of the 3 lines will compile.
B. All the 3 line will compile and print null true, true null and null null respectively.
C. Line 1 and 2 won't compile but line 3 will print null null.
D. Line 3 won't compile but line 1 and 2 will print null true and true null respectively. 
E. None of the above.

Multiple Choice Question

QID: 
321

Consider the following lines of code:

boolean greenLight = true;
boolean pedestrian = false;
boolean rightTurn = true;
boolean otherLane = false;
You can go ahead only if  the following expression evaluates to 'true' :
(( (rightTurn && !pedestrian || otherLane) || ( ? && !pedestrian &&
greenLight ) )  == true )

What variables can you put in place of '?' so that you can go ahead?

Select 1 option

A. rightTurn
B. otherLane
C. Any variable would do.
D. None of the variable would allow to go.

Multiple Choice Question

QID: 
320

Which line in the following code will cause the compilation to fail?

public class TestClass {
    
    public static void main(String[] args) throws Exception {
       work();                  //LINE 10
       int j = j1;               //LINE 11
       int j1 = (double) x; //LINE 12
    }
   
    public static void work() throws Exception{
        System.out.println(x); //LINE 15
    }
    static double x;    //19
}

Select 1 option

A. Line 10
B. Line 11
C. Line 12
D. Line 15
E. Line 19

Descriptive Question

QID: 
319

Drag and Drop valid operators in boxes.
= operator can be used more than once.
=        +=        *=
public class TestClass
{
public static void main(String[] args)
{
Short k = 9;    
Integer I =9;    
Boolean b = false;
char c = ‘a’;    
String str = “123”;

Multiple Choice Question

QID: 
318

Given:

byte b = 1;  
char c = 1;  
short s = 1; 
 int i = 1;

which of the following expressions are valid?

Select 3 options 

A. s = b * b ; 
B. i = b << b ; 
C. s <<= b ; 
D. c = c + b ; 
E. s += i ; 

Pages

Search the Web

Custom Search

Searches whole web. Use the search in the right sidebar to search only within javajee.com!!!

Quick Notes Finder Tags

Activities (1) advanced java (1) agile (3) App Servers (6) archived notes (2) ArrayLists (1) Arrays (2) Best Practices (12) Best Practices (Design) (3) Best Practices (Java) (7) Best Practices (Java EE) (1) BigData (3) Chars & Encodings (6) coding problems (2) Collections (15) contests (3) Core Java (All) (52) course plan (2) Database (12) Design patterns (8) dev tools (3) downloads (2) eclipse (9) Essentials (1) examples (14) Exception (1) Exceptions (4) Exercise (1) exercises (6) Getting Started (18) Groovy (2) hadoop (4) hibernate (77) hibernate interview questions (6) History (1) Hot book (4) http monitoring (2) Inheritance (4) intellij (1) java 8 notes (4) Java 9 (1) Java Concepts (7) Java Core (7) java ee exercises (1) java ee interview questions (2) Java Elements (16) Java Environment (1) Java Features (4) java interview points (4) java interview questions (4) javajee initiatives (1) javajee thoughts (3) Java Performance (6) Java Programmer 1 (11) Java Programmer 2 (8) Javascript Frameworks (1) Java SE Professional (1) JSP (1) Legacy Java (1) linked list (3) maven (1) Multithreading (16) NFR (1) No SQL (1) Object Oriented (9) OCPJP (4) OCPWCD (1) OOAD (3) Operators (4) Overloading (2) Overriding (2) Overviews (1) policies (1) programming (1) Quartz Scheduler (1) Quizzes (17) RabbitMQ (1) references (2) resources (1) restful web service (3) Searching (1) security (10) Servlets (8) Servlets and JSP (31) Site Usage Guidelines (1) Sorting (1) source code management (1) spring (4) spring boot (3) Spring Examples (1) Spring Features (1) spring jpa (1) Stack (1) Streams & IO (3) Strings (11) SW Developer Tools (2) testing (1) troubleshooting (1) user interface (1) vxml (8) web services (1) Web Technologies (1) Web Technology Books (1) youtube (1)