Week One Quiz

Learning java in just 5 weeks...


Please answer the following questions to proceed to week two tutorial

Q.1: What is the reason that pointer was eliminated from JAVA?

a) If forgotten to free the memory allotted to a variable it may crash.
b) Using pointers was a potential threat to security as pointer break security.
c) Pointers are used to built program such as computer viruses and hacking program.
d) All of the above.
Check the correct answer

Q.2: What is the right method to print the contents to display in monitor?

a) print ("My First Java Program");
b) printstream obj.print("My First Java Program");
c) System.out.println("My First Java Program");
d) None of the above.
Check the correct answer

Q.3: What is the main difference between print() and println()?

a) Both are not used in Java programming.
b) Both are used to print text but print () method prints text and retains cursor in the same line.
c) Both are used to print text but println () method prints text and kicks the cursor to the next line.
d) Both a & b are correct.
Check the correct answer

Q.4: Constants represent fixed values which should be written in the following naming convention?

a) Constants should be written by using all capital letters
b) The first word starts with a small letter and second word onwards start with a capital letter.
c) The first word and other consecutive words all start with capital letter.
d) All keywords should be written by using all small letter.
Check the correct answer

Q.5: what does 0.01 number represent in java data type category?

a) short
b) int and float
c) double and float
d) double
Check the correct answer

Q.6: The following code snippet falls into what operators category?
System.out.println("x>y : "+(x>y));

a) Arithmetic Operator
b) Relational Operator
c) Logical Operator
d) Bitwise Operator
Check the correct answer

Q.7: Look at the following code snippet and find out the right answers?

  public class MyProgram{
      public static void main(String args[]){
         int x;
         x=1; //beginning number is 1
         do{
         System.out.println(x);
         ++x;
         }while(x<=10);       }    } 
a) The first number will display 1 as value of x is already 1.
b) x++ will increment the value of x by 1 hence the value of x becomes 2.
c) As long as x value does not exceed 10, the loop repeats and number displays from 1 to 10.
d) None of the above.
e) a, b, and c all are correct.
Check the correct answer

Q.8 Find out incorrect answer from the following list?

a) System.exit(0)does not exist in Java
b)return statement is used inside a method to come out of it.
c) System.exit(0)is used in any method to come out of the program.
d) System.exit(0) terminates the program normally whereas
System.exit(1) terminates the program because of the some program error encountered.
Check the correct answer

Q.9 Arrays are stored on what memory?

a) Arrays are stored in Static Memory.
b)Static Memory is used to store arrys as well as variable, object etc. in Java.
c) Arrays are stored in Dynamic memory by JVM.
d) Arrays are stored in Dynamic Memory and variable or object are stored in Static Memory.
Check the correct answer

Q.10 Write a code that puts 45 into row 2 column 3 ?

------Column 0Column 1Column 2Column 3Column 4
Row 05565758595
Row 15666768696
Row 25767778797
grades[0][0], grades[0][1], grades[0][2], grades[0][3], grades[0][4];
grades[1][0], grades[1][1], grades[1][2], grades[1][3], grades[1][4];
grades[2][0], grades[2][1], grades[2][2], grades[2][3], grades[2][4];
a) grades[3][2]=45;
b) grades[2][3]=45;
c) grades[3][1]=45;
d) grades[0][2]=45;
Check the correct answer

Answers of the Week One tutorial questions



Q.1. Correct answer is d.



Q.2. Correct answer is c.



Q.3. Correct answer is d.



Q.4. Correct answer is a.



Q.5. Correct answer is d.



Q.6. Correct answer is b.



Q.7. Correct answer is e.



Q.8. Correct answer is a.



Q.9. Correct answer is c.



Q.10. Correct answer is b.



No comments:

OTN Discussion Forums: Message List - Database - General

Ask Tom HOT ARTICLES

 
© Copyright 2008 - 2011. All rights reserved to dba-sansar.blogspot.com.
All other blogs, posts and entries are the property of their respective authors.
Please email us for your comments and suggessions Click Here