"For every success of a man there will be a countless pain in his heart and that pain makes him a successful person in life"

When You are at the Peak of Concentration, You don't feel whether u r programming in C/C#/JAVA or any other, You just type the keys on keyboard and your sub-conscious mind does the rest...!

Myspace GlittersMyspace GlittersMyspace GlittersMyspace GlittersMyspace GlittersMyspace GlittersMyspace GlittersMyspace Glitters




 
   

SCJP Exam 1

   
 


 

 

Home

Guestbook

GALLERY

MySQL

C/C++ Interview Questions

C/C++ Test Paper 1

C/C++ Test Paper 2

C Tricky Snippets

C - Pointers

C - Functions

C - Iterations, Operators

Java Interview Questions

Java Fundamentals

Java FAQs

J2EE - FAQs

Java - Best Collection Ever

Java/J2EE Test 1

Java Test 2

Java Servlets - FAQs

SCJP 5.0 Syllabus

SCJP Exam 1

SCJP Exam 2

SCJP Exam 3

SCJP Exam 4

SCJP Exam 5

Relational Database Management Systems(RDBMS) Imp. Concepts

SQL Server - Interview Questions

SQL Server 2

Data Structures

OOPS - FAQs

Object Oriented Programming (OOP) Concepts

Operating Systems - FAQs

Operating System Concepts

Networking Concepts

UML - Quick Reference

VB - FAQs

Secrets About Windows Operating Systems

 


     
 

MOCK TEST 1

 

 

Question 1 :

 

public class A {

  public void m1() {System.out.print("A.m1, ");}

  protected void m2() {System.out.print("A.m2, ");}

  private void m3() {System.out.print("A.m3, ");}

  void m4() {System.out.print("A.m4, ");}

class B {

  public static void main(String[] args) {

    A a = new A();

    a.m1();  // 1

    a.m2();  // 2

    a.m3();  // 3

    a.m4();  // 4

}}

Assume that the code appears in a single file named A.java. What is the result of attempting to compile and run the program?

a. 

Prints: A.m1, A.m2, A.m3, A.m4,

b. 

Compile-time error at 1.

c. 

Compile-time error at 2.

d. 

Compile-time error at 3.

e. 

Compile-time error at 4.

f. 

None of the above

 

Question 2

class GFM11{

  public static void main (String[] args) {

    int x,y,z;

    System.out.println(x+y+z);

}}

What is the result of attempting to compile and run the program?

a. 

Prints nothing.

b. 

Prints an undefined value.

c. 

Prints: null

d. 

Prints: 0

 

e. 

Run-time error

f. 

Compile-time error

g. 

None of the above

 

Question 3

class MCZ11 {

  public static void main (String[] args) {

    char a = 'c';  // 1

    char b = 'r';  // 2

    char c = '"';  // 3

    char d = 'b';  // 4

    char e = ''';  // 5

}}

A compile-time error is generated at which line?

a. 

1

b. 

2

c. 

3

d. 

4

e. 

5

f. 

None of the above

Question 4

class MWC101 {

  public static void main(String[] args) {

    int[] a1 = new int[];              // 1

    int a2[] = new int[5];             // 2

    int[] a3 = new int[]{1,2};         // 3

    int []a4 = {1,2};                  // 4

    int[] a5 = new int[5]{1,2,3,4,5};  // 5

}}

Compile-time errors are generated at which lines?

a. 

1

b. 

2

c. 

3

d. 

4

e. 

5

Question 5

class A {A(int i) {}}  // 1

class B extends A {}   // 2

Which of the following statements are true?

a. 

The compiler attempts to create a default constructor for class A.

b. 

The compiler attempts to create a default constructor for class B.

c. 

Compile-time error at 1.

d. 

Compile-time error at 2.

 

Question 6

Which of the following statements are true?

a. 

A constructor can invoke another constructor of the same class using the alternate constructor invocation, "this(argumentListopt);".

b. 

A constructor can invoke itself using the alternate constructor invocation, "this(argumentListopt);".

c. 

The alternate constructor invocation, "this(argumentListopt);", can legally appear anywhere in the constructor body.

d. 

A constructor can invoke the constructor of the direct superclass using the superclass constructor invocation, "super(argumentListopt);".

e. 

The number of constructor invocations that may appear in any constructor body can equal but not exceed the number of alternate constructors declared in the same class.

f. 

A constructor is not permitted to throw an exception.

Question 7

class A {A() throws Exception {}} // 1

class B extends A {B() throws Exception {}} // 2

class C extends A {C() {}} // 3

Which of the following statements are true?

a. 

class A extends Object.

b. 

Compile-time error at 1.

c. 

Compile-time error at 2.

d. 

Compile-time error at 3.


Question 8

Which of the following modifiers can be applied to a constructor?

a. 

private

b. 

abstract

c. 

final

d. 

volatile

e. 

native

f. 

None of the above.


Question 9

Which of the following modifiers can be applied to the declaration of a field?

a. 

abstract

b. 

final

c. 

private

d. 

protected

e. 

public

 

Question 10

Which of the following modifiers can not be applied to a method?

a. 

abstract

b. 

private

c. 

protected

d. 

public

e. 

Volatile

f. 

None of the above.

 

 

 
 

 

 

Thank You.. Visit Again

This website was created for free with Own-Free-Website.com. Would you also like to have your own website?
Sign up for free