Java Ch 1-3 Test

47 Questions | Total Attempts: 170

SettingsSettingsSettings
Java Ch 1-3 Test - Quiz

Questions and Answers
  • 1. 
    The ____ is the brain of the computer.
    • A. 

      Arithmetic logic unit

    • B. 

      Central processing unit

    • C. 

      Accumulator

    • D. 

      Control unit

  • 2. 
    All data must be brought into ____ before a program can manipulate it.
    • A. 

      Secondary storage

    • B. 

      Main memory

    • C. 

      An output device

    • D. 

      All answers are correct

  • 3. 
    When the power is switched off, everything in ____ is lost.
    • A. 

      Main memory

    • B. 

      Secondary storage

    • C. 

      Hard disks

    • D. 

      Floppy disks

  • 4. 
    The devices that feed data and programs into computers are called ____.
    • A. 

      Output devices

    • B. 

      Input devices

    • C. 

      Monitors

    • D. 

      Printers

  • 5. 
    The term MB refers to ____.     
    • A. 

      Megabyte

    • B. 

      My byte

    • C. 

      Moving byte

    • D. 

      None of the answers are correct

  • 6. 
    A program called a(n) ____ translates the assembly language instructions into machine language and then executes it.
    • A. 

      Loader

    • B. 

      Interpreter

    • C. 

      Compiler

    • D. 

      Assembler

  • 7. 
    In a Java program, the file name must be the same as the ____.
    • A. 

      Method name

    • B. 

      Class name

    • C. 

      Object name

    • D. 

      Data name

  • 8. 
    When all ____ errors are removed, the compiler generates the machine code (bytecode in Java).
    • A. 

      Logical

    • B. 

      Syntax

    • C. 

      Linking

    • D. 

      Run-time

  • 9. 
    To develop a program to solve a problem, you start by ____.
    • A. 

      Analyzing the problem

    • B. 

      Implementing the solution in Java

    • C. 

      Designing the algorithm

    • D. 

      Entering the solution into a computer system

  • 10. 
    In Java, the mechanism that allows you to combine data and operations on the data into a single unit is called a(n) ____.
    • A. 

      Object

    • B. 

      Class

    • C. 

      Method

  • 11. 
    The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language.
    • A. 

      Semantic

    • B. 

      Logical

    • C. 

      Syntax

    • D. 

      Grammatical

  • 12. 
    Which of the following is NOT a special symbol in Java?
    • A. 

      +

    • B. 

      #

    • C. 

      !=

    • D. 

      ?

  • 13. 
    Which of the following identifiers is not valid?
    • A. 

      Sum

    • B. 

      _sum

    • C. 

      $sum

    • D. 

      5sum

  • 14. 
    Oranges = oranges * (expression); is equivalent to oranges *= expression;
    • A. 

      True

    • B. 

      False

  • 15. 
    Primitive Data types in Java do not include:
    • A. 

      Integral

    • B. 

      Floating Point

    • C. 

      Boolean

    • D. 

      Decimal

  • 16. 
    Integral Data Types in Java do not include:
    • A. 

      Char

    • B. 

      Long

    • C. 

      Int

    • D. 

      Double

  • 17. 
    A null or empty string has at least one character that is a space.
    • A. 

      True

    • B. 

      False

  • 18. 
    Named constants
    • A. 

      They cannot be changed during program execution

    • B. 

      They are declared using the reserved word final

    • C. 

      They are initialized when they are declared

    • D. 

      They should be created in all capital letters

  • 19. 
    Int num1; The statement above declares and initializes the value of num1.
    • A. 

      True

    • B. 

      False

  • 20. 
    Which of the following methods would you use to read in a number such as 2.3 for a variable?
    • A. 

      Next();

    • B. 

      NextInt();

    • C. 

      NextDouble();

    • D. 

      NextLine();

  • 21. 
    The value of the expression 26 – 14 % 3 + 1 is ____.
    • A. 

      0

    • B. 

      1

    • C. 

      24

    • D. 

      25

  • 22. 
    Which of the following is a legal identifier?
    • A. 

      Program!

    • B. 

      Program_1

    • C. 

      1program

    • D. 

      Program 1

  • 23. 
    Which of the following is a valid int value?
    • A. 

      46,259

    • B. 

      46259

    • C. 

      462.59

    • D. 

      46,259.59

  • 24. 
    Consider the following sequence of statements.   String str; int num1, num2; num1 = 13; num2 = 24; str = "The sum = " + num1 + num2; What is the final value stored in str?
    • A. 

      The sum = 37

    • B. 

      The sum = 13 24

    • C. 

      The sum = 13 + 24

    • D. 

      The sum = 1324

  • 25. 
    What is the output of the following statement? System.out.println("Welcome \n Home");
    • A. 

      WelcomeHome

    • B. 

      Welcome Home

    • C. 

      Welcome Home

    • D. 

      Welcome \n Home

Back to Top Back to top