Java Programmer Certification Mock Exam No 1

4 Questions | Total Attempts: 123

SettingsSettingsSettings
Please wait...
Programmer Quizzes & Trivia

Copyright ©Marcus Green 2002 Last Updated 18 Sep 2003 This exam is based on the objectives of the JDK 1. 2 exam. You can see set of 60 questions for the JDK1. 4 exam at JDK1. 4 Exam


Questions and Answers
  • 1. 
    Which of the following lines will compile without warning or error? 1) 2)3) 4) 5)
    • A. 

      Float f=1.3;

    • B. 

      Char c="a";

    • C. 

      Byte b=257;

    • D. 

      Boolean b=null;

    • E. 

      Int i=10;

  • 2. 
    What will happen if you try to compile and run the following code? public class MyClass { public static void main(String arguments[]) { amethod(arguments); } public void amethod(String[] arguments) { System.out.println(arguments); System.out.println(arguments[1]); } }
    • A. 

      Error Can't make static reference to void amethod

    • B. 

      Error method main not correct error method main not correct error method main not correct error method main not correct

    • C. 

      Error array must include parameter

    • D. 

      Amethod must be declared with String

  • 3. 
    Which of the following will compile without error a) import java.awt.*; package Mypackage; class Myclass {} b) package MyPackage; import java.awt.*; class MyClass{} c) /*This is a comment */ package MyPackage; import java.awt.*; class MyClass{}
    • A. 

      A

    • B. 

      B

    • C. 

      C

    • D. 

      A and b

    • E. 

      B and c

    • F. 

      None of the choices.

  • 4. 
    A byte can be of what size?
    • A. 

      -128 to 127

    • B. 

      (-2 power 8 )-1 to 2 power 8

    • C. 

      -255 to 256

    • D. 

      Depends on the particular implementation of the Java Virtual machine