Professional Documents
Culture Documents
4)
JavaBeat Home SCJP 1.4 Home Objectives Forums Mock Exams Online Mock Exam Resources
Mock Exams
MockQuestions - 1 MockQuestions - 2 MockQuestions - 3 MockQuestions - 4
MockQuestions - 5 MockQuestions - 6 MockQuestions - 7 MockQuestions - 8
MockQuestions - 9 MockQuestions - 10 MockQuestions - 11 MockQuestions - 12
MockQuestions - 13 MockQuestions - 14 MockQuestions - 15 MockQuestions - 16
MockQuestions - 17 MockQuestions - 18 MockQuestions - 19 MockQuestions - 20
Mock Exam - 4
Q1 Which of the following are the correct form of documentation comments?
A1 //some text here
A2 /*some text here*/
A3 /**some text here*/
A4 all the above
State the correct formula for minimum/maximum values for integer primitives
Q2
where no_of_bits is the size of the type in bits.
A1 2^(no_of_bits-1) / 2^(no_of_bits-1)+1
A2 2^(no_of_bits+1) / 2^(no_of_bits+1)+1
A3 2^(no_of_bits-1) / 2^(no_of_bits-1)-1
A4 all the above
which of the following is the correct way to define a class that will be in the
Q4
default package
package default;
A1 import java.util.*;
import java.util.*;
A2
package default;
A3 import java.util.*;
A4 all the above
When writing a utility class, someclass, which extends mainclass class and will
Q8 be used by several other classes in a large project. These other classes will be in
different packages.Pick the correct class declaration
A1 class someclass extends mainclass
A2 protected class someclass extends mainclass
A3 public class someclass extends mainclass
A4 none
System.out.println(args[1]);
Q10 }
The above is compiled and then executed by the following command line.
c. there is nothing like explicit declaration for default package. The class is added to
4
default package if there is no package statement.
h Valid declaration for the main() method must be public and static, have void as return
type and take a single array of String objects as arguments. The order of public and
5
static keywords is irrelevant. Also declaring the method final does not effect the method's
potential to be used as a main() method.
6 b
7 c . There are no friend functions as in C++.
8 c
9 b
10 b Array index start from 0. So somearray[0] points to the first element in the array.
JavaBeat 2005, India (www.javabeat.net)
Submit a Site - Directory - Submit Articles