Java interview questions

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.









Related Tutorials/Questions & Answers:
interview - Java Interview Questions
interview  kindly guide me some interview questions of Java
interview questions - Java Interview Questions
interview questions for Java  Hi Any one can u please post the interview point of questions.Warm Regards, Satish
Advertisements
java - Java Interview Questions
Helpful Java Interview questions   Need Helpful Java Interview questions
Java Interview Questions
Java Interview Questions  Hi, Can anyone tell the urls of Java Interview Questions on roseindia.net? Thanks
Struts - Java Interview Questions
Struts Interview Questions  I need Java Struts Interview Questions and examples
java interview - JSP-Interview Questions
java interview  what type of questions would be asked to a 3 years experience person in java? can anyone please provide list of topics or interview questions for 3 years experience in java
Interview Question - Java Interview Questions
Interview Question  I need Interview Questions on Java,J2EE Pls help me
jvm - Java Interview Questions
jvm  Can you provide some JVM Questions for Java Interview preparation
help me - Java Interview Questions
interview questions java pdf   Do you have any PDF for Java Interview questions
java questions - Java Interview Questions
java questions  HI ALL , how are all of u?? Plz send me the paths of java core questions and answers pdfs or interview questions pdfs or ebooks :) please favor me best books of interviews questions for craking
java - Java Interview Questions
Java Development  I need a Job in Java Development..so preparing for it. Can anyone please guide me how to prepare and what are the common questions that can be asked at interview
hint - Java Interview Questions
hint  Dear roseindia, i want the java interview question and the corresponding question answers.   Hi Friend, Please visit... of interview questions and their answers. Thanks  thanks for your
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
java - Servlet Interview Questions
java  servlet interview questions  Hi friend, For Servlet interview Questions visit to : http://www.roseindia.net/interviewquestions/servlet/ Thanks
Java - Java Interview Questions
Java  Questions on Java
java - Servlet Interview Questions
Java Design Patterns Interview Questions and Answers  I need to know Java Design Patterns with the help of Interview Questions and Answers  Hi malli,GenericServlet is the super class of HttpServlet calssjava soft
java - Java Interview Questions
/interviewquestions/ Here you will get lot of interview questions...java  hello sir this is suraj .i wanna ask u regarding interview questins in java .wat normally v see in interviews (tech apptitude)is one line
java - Java Interview Questions
Java interview questions and answers for freshers  Please provide me the link of Java interview questions and answers for freshers  Hi friend,class Point{ int x, y; Point(){ System.out.println("default"
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 - Java Interview Questions
java  i want to java&j2ee interview questions. Regards Akhilesh Kumar  Hi friend, I am sending you a link. This link will help you. Read for more information. http://www.roseindia.net/interviewquestions
Interview question - Java Interview Questions
Interview question   Hi Friends, I am new to java, can u tell me what is class ,object and instance with example. For example : class raja , raja r = new raja(); ,here raja is class and r is instance
Interview question - Java Interview Questions
Interview question   Hi Friends, Give me details abt synchronization in interview point of view. I mean ow to explain short and neat. Thanks
Interview Tips - Java Interview Questions
Interview Tips  Hi, I am looking for a job in java/j2ee.plz give me interview tips. i mean topics which i should be strong and how to prepare. Looking for a job 3.5yrs experience
interview question - Java Interview Questions
interview question  hello i want technical interview question in current year   Hi Friend, Please visit the following links: http://www.roseindia.net/interviewquestions/ http://www.roseindia.net
Java - Java Interview Questions
Interview interview, Tech are c++, java,  Hi friend, Now get more information. you can lean all type interview question by following link
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 - JSP-Interview Questions
java  hi.. snd some JSP interview Q&A and i wnt the JNI(Java Native Interface) concepts matrial thanks krishna  Hi friend, Read more information. http://www.roseindia.net/interviewquestions/jsp-interview
Interview Question - Java Interview Questions
Interview Question  1)If we give S.O.P. statement after finally block shall it prints or not? 2)Write a program in java to read a file & write in to another file? 3)Write a program taking two arrays and compare those two
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
java - Java Interview Questions
while searching on google but if you want you can learn it in a interview preparation manner as well.. I have a java interview question URL from where you...://www.roseindia.net/java if you wanna something more on java
java - Java Interview Questions
java  MNC now which modal question are asked in interview
Jsp - Java Interview Questions
Need JSP Interview Questions  Hi, I need JSP interview questions.Thanks
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 Interview - Java Interview Questions
Java Interview  Please provide some probable Java interviewe Question. Thanking you. Pabitra kr debanth.  Hi friend, I am sending you a link. This link will help you. Please visit for more information
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.ADS_TO_REPLACE_1 These Core Java Interview Questions
java interview question and answer - Java Interview Questions
java interview question and answer   sir, i want one mark java interview question and answers
Java - Java Interview Questions
://www.roseindia.net/java/example/java/util/HashTable.shtml Thank you for posting questions. Rose India Team
JAVA - Java Interview Questions
JAVA  i need objective Questions and answers ( with 4 or 5 choice) in JAVA. Can anyone help me?   H1!! pl. mail your email id to [email protected]. I will send you within 2-3 days. Krishna
architecture - Java Interview Questions
architecture  Hi, can any body tell me how to explain ATG architecture in interview
Java - Java Interview Questions
Java  Hi How to write java code inorder to get the comments written in a java program? Please let me know..this was asked in my interview... in details. For more information on Java visit to : http://www.roseindia.net/java
Collection of Large Number of Java Interview Questions!
Interview Questions - Large Number of Java Interview Questions Here you.... The Core Java Interview Questions More interview questions on core Java
java - JSP-Interview Questions
. These are all fairly fundamental questions, try purchasing any introduction to Java...java  whats meant by the following terms as applied in java:- 1.object oriented programming. 2.void 3.private 4.protected thanks homey.  
java - Java Interview Questions
Java Programming  What is Java Programming language
java - Java Interview Questions
java  how to learn java
Java - Java Interview Questions
Java  definition for "USER DEFINE PACKAGE FOR JAVA
java - Java Interview Questions
Java io package hierarchy   What is the hierarchy for Java io Package
java - Java Interview Questions
java  Is JAVA 100% OOPL??  Hi friend, Yes,Java is 100% OOPL. Thanks
java - Java Interview Questions
Java a complete reference  Need a Complete reference on Java.  www.geekinterview.com/question_details/17043
java - Java Interview Questions
Friend, Please visit the following links: http://www.roseindia.net/java/java-tips/background/60garbage_collection.shtml http://www.roseindia.net/java/beginners/GarbageCollection.shtml http://www.roseindia.net/java/example/java/io/code
java - Java Interview Questions
java   java.lang.exception is apublic or protected or serializable... visit to : http://www.roseindia.net/java/exceptions/ http://www.roseindia.net/java/exceptions/exception-classes.shtml Thanks

Ads