Java interview questions

Ads
 

Java interview questions

Plz answer the following questions.....

  1. The type long can be used to store values in the following range: a. -263 to 263 - 1 b. -231 to 231 - 1 c. -264 to 264 d. -232 to 232 - 1

  2. Which of the following is not a hexadecimal number? (A) 999 (B) (hex)23 (C) 0x556 (D) 0x1F2

a. (A) b. (A) & (B) c. (C) d. (A), (B) & (C)

  1. Select the invalid assignment statements from the following: (A) float x = 238.88; (B) double y = 0x443; a. (B) b. (B) & (D) c.(A) & (B) d.(A) & (C)

  2. If not assigned a value, a variable of type char has the following default value: a. '\uffff' b. " " (space) c. '\u0001' d. '\u0000'

  3. 15 & 29 = ? a. 44 b. 14 c. 13 d. 12

  4. 27 | 8 = ? a. 8 b. 27 c. 19 d. 35

  5. Identify the statements that are correct: (A) int a = 13, a>>2 = 3 (B) int b = -8, b>>1 = -4 (C) int a = 13, a>>>2 = 3 (D) int b = -8, b>>>1 = -4

a. (A), (B), (C) & (D) b. (A) & (B) c. (C) & (D) d. (A), (B) & (C)

  1. Consider the following code: int x, y, z; y = 1; z = 5; x = 0 - (++y) + z++; After execution of this, what will be the values of x, y and z? a. x = 4, y = 1, z = 5 b. x = -7, y = 1, z = 5 c. x = 3, y = 2, z = 6 d. x = 4, y = 2, z = 6

  2. What will be the result of the expression a % b when a and b are of type int and their values are a = 10 and b = 6? a. 4 b. 1.66 c. 1 d. None of these

  3. What will be the result of the expression a % b when a and b are of type int and their values are a = -17 and b = -6? a. -5 b. -23 c. None of these d. 5

View Answers

May 30, 2011 at 3:48 PM

1) -263 to 263 - 1, The type long is a 64-bit two's complement that can be used for long integers.

2) (A) & (B), Hexadecimal numbers start with "0x" in the Java programming language.

1)

2) \u0000, The value of a variable of type char is 16 bits of data formatted as a Unicode character.

3) 13,When written in binary format, 15 is 1111, and 29 is 11101. 1111 & 11101 is 1101, which is 13 in decimal.

4) 27, When written in binary format, 27 is 11011, and 8 is 1000. 11011 | 1000 is 11011, which is 27.

5) (A), (B) & (C), The shift operation "y1 >>> y2" is identical to "y1 >> y2" for all positive values of y1. It shifts the bits in y1 to the right by y2 positions.

1) x = 3, y = 2, z = 6, Both y and z get incremented as a result of the last statement, but y gets incremented before and z after the assignment of the calculated value to x.

2) 4, The modulus operator (%) may be used with floating-point as well as integer types. It returns the remainder of a division operation. Therefore, 10 % 6 will return 4.

5) 5, The a % b calculates the remainder when a is divided by b.

Ads









Related Tutorials/Questions & Answers:
Java Interview Questions
Java Interview Questions  Hi, Can anyone tell the urls of Java Interview Questions on roseindia.net? Thanks
Interview Questions - What is Java?
Interview Questions - What is Java?  What is Java?   Hi, Java is high level programming langue developed by James Gosling. Now Java.... Check in detail at: What is Java? View all Java Interview Questions
Advertisements
Interview Questions - Where Java is used?
Interview Questions - Where Java is used?  Hello, Where Java is used? Thanks   Hi, Java is used for creating various types... being Used?. View all interview questions at Java Interview Questions with Answers
Java interview questions and answers
Java interview questions and answers   what is garbage collection? What is the process that is responsible for doing that in java? Ans.Reclaiming... in Java? Ans. Runtime.getRuntime().exec(â?¦.) 5.What is the basic difference
Interview Questions - How Java is Used?
Interview Questions - How Java is Used?  Hi, How Java is Used... For Creating Applets Check: Where is Java being Used? View all interview questions at Java Interview Questions with Answers page. Thanks
Java - Java Interview Questions
Java  definition for "USER DEFINE PACKAGE FOR JAVA
Java - Java Interview Questions
Java  What is meant by Stream Tokenizer ?   hi friend, To understand the Stream Tokenizer, visit to: http://www.roseindia.net/java/example/java/io/tokenizingjavasourcecode.shtml Thanks RoseIndia Team
Java interview questions
Java interview questions  Plz answer the following questions..... The type long can be used to store values in the following range: a. -263 to 263 - 1 b. -231 to 231 - 1 c. -264 to 264 d. -232 to 232 - 1 Which
Java - Java Interview Questions
it as System.out.println(); For more information on Java visit to : http://www.roseindia.net/java/ Thanks
java - Java Interview Questions
out = new BufferedWriter(fstream); out.write("Hello Java"); //Close
cms - Java Interview Questions
alfresco concepts in core java,webapplications and webservices).i haver some information in net,i want how to implement alfresco in core java
urgent - Java Interview Questions
display the url one by one.using core java technology (e.g)when am requesting...://www.roseindia.net/java/example/java/io/file-url-download.shtml Thanks
Core Java Interview questions and answers
Core Java Interview questions and answers  .... So, we have tried to create most frequently asked Core Java Interview Questions and answers in one place. These Core Java Interview Questions are supported
Java - Servlet Interview Questions
Difference between server and application server for Java  What is the difference between server and application server for Java?  Hello,Here is the differenceWeb server:* Servers Static contents* Directly receives
Interview Questions - What are important features of Java?
Interview Questions - What are important features of Java?  Hi, What are important features of Java? Thanks   Hi, Being a popular Object.... Check All Java Features. View all interview questions at Java Interview
Interview Questions - What are important Java Language Elements?
Interview Questions - What are important Java Language Elements?  Hi, What are important Java Language Elements? Thanks   Hi, Java.... View all interview questions at Java Interview Questions with Answers page
Java Interview Questions with Answers
Java Interview Questions with Answers for freshers Are you looking for largest database of interview questions for preparing for your interviews then you... in Java. Go through all these interview questions and this will help you
help needed - Java Interview Questions
help needed  What are the new features added in jdk 1.5?  Hi friend, The following were the new features added in java 1.5. * Generics * Enhanced for loop * Metadata * Static import * Typesafe enums
Core java Interview Questions
Here are the Core Java Interview Questions that can be asked to you by interviewers. These frequently asked Core Java Interview Questions will be beneficial to software developers going for Java developer Interviews. Q 1. Difference
Interview Questions - What are important Java Editions or Parts of Java?
Interview Questions - What are important Java Editions or Parts of Java?  Hi, What are important Java Editions or Parts of Java? How many components... and Tutorials. View all interview questions at Java Interview Questions with Answers
Hibernate interview Questions
Hibernate interview Questions  Pl share hibernate interview questions.I have found one popular website to learn java J2EE technology, but in that they have currently not updated interview questions. They have explain so many new
java application Performance optimization - Java Interview Questions
java application Performance optimization  Please tell me brief or some useful links about java application performance opotimization
Interview Questions - What is JRE?
and JVM? View all interview questions at Java Interview Questions with Answers...Interview Questions - What is JRE?  Hi, What is JRE? Thanks   Hi, JRE is known as Java Runtime Environment and its minimal components
Interview Questions - What is JDK?
. Check: Beginners Java Tutorials - Installing JDK. View all interview questions at Java Interview Questions with Answers page. Thanks   Video tutorial...Interview Questions - What is JDK?  Hi, What is JDK? Thanks  
Hi - Hibernate Interview Questions
Hi   please send me hibernate interview questions
interview questions
interview questions   Tell us about a situation where you had to solve a difficult problem. What did you do? What is your typical way of dealing with conflict? Give us an example. Tell us about a problem that youââ?¬â?˘ve solved
interview questions
interview questions   Tell us about a situation where you had to solve a difficult problem. What did you do? What is your typical way of dealing with conflict? Give us an example. Tell us about a problem that youâ??ve solved
interview questions
interview questions   Tell us about a situation where you had to solve a difficult problem. What did you do? What is your typical way of dealing with conflict? Give us an example. Tell us about a problem that youâ??ve solved
interview questions
interview questions   Tell us about a situation where you had to solve a difficult problem. What did you do? What is your typical way of dealing with conflict? Give us an example. Tell us about a problem that youâ??ve solved
About interview questions
About interview questions   I want interview questions on IDE's Please send links
Important Interview Questions in Core Java
Important Interview Questions in Core Java Core Java refers... questions. Mastering in Java is a different thing and facing an interview... who are master in advanced java as whenever you go for the interview

Ads