Mld1 Class Final Review Part1

10 Questions | Total Attempts: 82

SettingsSettingsSettings
Mld1 Class Final Review Part1 - Quiz

MLD1 Class Mid-Term Review Part1


Questions and Answers
  • 1. 
    The line of Java code below has the last character missed.int lastOne = 3The missed character is:
    • A. 

      #

    • B. 

      {

    • C. 

      "

    • D. 

      ;

  • 2. 
    The text below is a fragment of a Java code. public class Random {public static void main(String[] args) {int rMath = Math.random()*100 == This code should be saved as:
    • A. 

      Public class.java

    • B. 

      Class Random.java

    • C. 

      Random.java

    • D. 

      Random.java

  • 3. 
    According to the Java program code fragment below,public class Random { public static void main(String[] args) { int rMath = Math.random()*100 == int rMath means:
    • A. 

      RMath is a name of an undefined variable

    • B. 

      RMath is a variable and its value is an integer

    • C. 

      RMath is the name of the program

    • D. 

      Int rMath is a typo and should be fixed

  • 4. 
    The following line of a Java code:System.out.println("The number = " + num);makes the computer to:
    • A. 

      Print a new line "The number = + num".

    • B. 

      Print a new line "The number = " and then the value of the variable "num".

    • C. 

      Prints a line "The number = + num" on a paper using a printer.

    • D. 

      Prints a new line showing only the value of the variable "num".

  • 5. 
    For the code line: System.out.println("The number = " + num); and the code line:System.out.print("The number = " + num);,the following is true:
    • A. 

      They do exactly the same thing.

    • B. 

      They print out different numbers.

    • C. 

      The first one makes the continuation of the text/information to be printed on the next line. The second does not, so that the new information would be printed on the same line.

    • D. 

      None of the above is true for these two lines.

  • 6. 
    The line: tenPercentTax = 0.10*(netIncome - 30000);means:
    • A. 

      The value of the variable "tenPercentTax" equals to the result of (netIncome - 30000) times 0.10

    • B. 

      The value of the variable "tenPercentTax" equals to the result of 0.10 times the variable "netIncome" and then minus 30000.

    • C. 

      The value of the variable "tenPercentTax" equals to the result of 0.10 times 30000 and then minus the variable "netIncome".

    • D. 

      The value of the variable "tenPercentTax" equals to the result of 0.10 times negative 30000.

  • 7. 
    The word "double" in the following Java code line:double sum =means that
    • A. 

      Variable "sum" will be multiplied by 2.

    • B. 

      The memory space for the variable "sum" will be twice more than a regular one.

    • C. 

      There are actually 2 variables called "sum".

    • D. 

      Variable "sum" may not have more than 2 digits.

  • 8. 
    In Java code, The following line:String name = "Student";actually means:
    • A. 

      The next string has its own name "Student"

    • B. 

      Student's name must be typed in.

    • C. 

      "name" is a text variable and its value is the word "String"

    • D. 

      "name" is a text variable and its value is the word "Student"

  • 9. 
    A Java class code ends with:
    • A. 

      }

    • B. 

      )

    • C. 

      ]

    • D. 

      ()

  • 10. 
    An integer is:
    • A. 

      A positive whole number

    • B. 

      A decimal

    • C. 

      Any whole number (includes positive, negative, and zero)

    • D. 

      A fraction

Back to Top Back to top