GoConqr has a new look! Let us know what you think.

Quiz

Chapter 1: Quiz

Ed Woo 25 questions Updated 23 Nov 2016

Take the quiz

Questions in this quiz (25)

  1. 1 In the following code, identify which line is redundant.

    1. import java.lang.String;
    2. import java.lang.*;
    3. public class Foo {
    4. String name;
    5. }
    1. A4
    2. B1
    3. C2
    4. D3
  2. 2Which of the following import statements imports an entire group of classes contained in the java.lang package?
    1. Aimport *.java.lang
    2. Bimport *.java.lang;
    3. Cimport java.lang.*
    4. Dimport java.lang.*;
  3. 3Which path does the Java runtime environment use for searching?
    1. AClass path
    2. BFile Path
    3. CEnvironment path
    4. DSearch path
  4. 4Which of the following will create a package named My?
    1. Apackage My[];
    2. Bpackage My;
    3. Cpack My();
    4. Dpackage My package;
  5. 5Consider the given string:

    Mack John Lisa Maria


    What is the output of the following Java statement?

    System.out.println(args[2]);
    1. ALisa
    2. BMaria
    3. CMack
    4. DJohn
  6. 6For any non-null reference values a and b, which of the following values will be returned by the expression a.equals(b) if b.equals(a) returns true?
    1. Atrue
    2. Bfalse
    3. Cnull
    4. D0
  7. 7In the following code, you need to import the two classes FileInputStream and FileOutputStream.

    public class CopyFile {
    String name;
    }


    What is the best way to import these files?
    1. Aimport java.FileInput Stream;
      import java.FileOutput Stream;
    2. Bimport java.nio.*;
    3. Cimport java.*.*;
    4. Dimport java.io.FileInputStream.*;
      import java.io.FileOutputStream.*;
  8. 8Which two keywords are used for decimal-point value?
    1. Ashort and long
    2. Bfloat and double
    3. Cfloat and long
    4. Dlong and double
  9. 9What is the default initialization value of long variable type?
    1. Afalse
    2. B0
    3. C0.0
    4. Dnull
  10. 10Which of the following represents the correct sequence of these three in a Java application?

    1. package declaration
    2. class definition
    3. import statement
    1. A1, 2, 3
    2. B3, 2, 1
    3. C1, 3, 2
    4. D2, 3, 1

Information

Description
Java I Quiz on Chapter 1: Quiz, created by Ed Woo on 26/07/2016.
Author
Ed Woo
Language
English
Views
0
History
Created on 26 Jul 2016 · updated on 23 Nov 2016
Tags
java i
Rating
No ratings yet
Rate this quiz
Rate this quiz

Feedback

What is it about?

What do you think of the new look?

How do you like it?