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

Quiz

Untitled

Jamie M 50 questions

Take the quiz

Questions in this quiz (50)

  1. 1By default, a reference variable that is an instance field is initialized to the value
    1. Anull
    2. B0
    3. Cvoid
    4. Dstatic
  2. 2If you write a toString method for a class, Java will automatically call the method any time you concatenate an object of the class with a string.
    1. ATrue
    2. BFalse
  3. 3Of the following, which would be considered the no-arg constructor for the Rectangle class?
    1. Apublic Rectangle (int len, int width)
    2. Bpublic Rectangle (double len, double width
    3. Cpublic Rectangle()
    4. DAll of these
  4. 4The key word "this" is the name of a reference variable that an object can use to refer to itself.
    1. ATrue
    2. BFalse
  5. 5What will be returned from the method, if the following is the method header?

    public Rectangle getRectangle()
    1. Athe address of an object of the Rectangle class
    2. Bthe values stored in the data members of the Rectangle object
    3. Ca null value
    4. Dan object that is contained in the class Rectangle
  6. 6When a method's return type is an object, what is actually returned to the calling program?
    1. Aa reference to an object of that class
    2. Bonly the values in the object that the method accessed
    3. Can object of that class
    4. Da null reference
  7. 7When an object is passed as an argument, it is actually a reference to the object that is passed.
    1. ATrue
    2. BFalse
  8. 8Assume that inputFile references a Scanner object that was used to open a file. Which of the following while loops shows the correct way to read data from the file until the end of the file is reached?
    1. Awhile (inputFile.nextLine == " ")
    2. Bwhile (inputFile != null)
    3. Cwhile (! inputFile.EOF)
    4. Dwhile (inputFile.hasNext())
  9. 9Before entering a loop to compute a running total, the program should first
    1. Aset the accumulator variable to an initial value, usually zero
    2. Bset all variables to zero
    3. Cread all the values into main memory
    4. Dknow exactly how many values there are in total
  10. 10How many times will the following for loop be executed?

    for(int count = 10; count <= 21; count++)
    System.out.println("Java is great!");
    1. A0
    2. B12
    3. C10
    4. D11

Information

Description
Quiz on Untitled, created by Jamie M on 24/07/2018.
Author
Jamie M
Language
English
Views
1
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?