Mld1 Mid-term Exam Part1

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Teacherv
T
Teacherv
Community Contributor
Quizzes Created: 5 | Total Attempts: 514
| Attempts: 93 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. To make variable "dat" equal to 5 which of the following lines of Java code should be used:

Explanation

The correct answer is "int dat = 5;". This line of code declares a variable named "dat" of type integer and assigns it the value of 5. This will make the variable "dat" equal to 5. The other options are incorrect because they either assign a string value to the variable or attempt to print the value without declaring the variable first.

Submit
Please wait...
About This Quiz
Mld1 Mid-term Exam Part1 - Quiz

The MLD1 Mid-Term Exam Part1 assesses basic Java programming skills. It covers variable initialization, output commands, file naming, syntax, and compilation prerequisites. This quiz is essential for learners... see moreaiming to solidify foundational Java knowledge. see less

2. To make a Java program print "Java",
which of the following lines of Java code should be used:

Explanation

The correct answer is System.out.print("Java"). This is because System.out.print is a method in Java that is used to print the specified text to the console. In this case, "Java" is the text that we want to print. The correct syntax for calling this method is to use parentheses () to enclose the text that we want to print. Therefore, the correct line of code to make a Java program print "Java" is System.out.print("Java").

Submit
3. A program "class SavProg2" should be saved as:

Explanation

The correct answer is "SavProg2.java" because in Java, the convention is to save a program file with the same name as the main class in the program. In this case, the main class is "SavProg2", so the file should be saved as "SavProg2.java".

Submit
4. Which character usually ends up a Java program code?

Explanation

The character "}" usually ends up a Java program code. This character is used to close a block of code, such as a class, method, or loop. It is important to have matching opening and closing braces to ensure the code is properly structured and executed. The other characters mentioned (@, &, #) do not typically signify the end of a Java program code.

Submit
5. You cannot compile your Java program until you

Explanation

To compile a Java program, it needs to be saved first. Saving the program ensures that the changes made to the code are stored in a file on the computer's storage. Once the program is saved, it can be compiled using a Java compiler, which will translate the code into a format that can be executed by the computer. Therefore, saving the Java program is a necessary step before compiling it.

Submit
6. A Java class code contains the following line:public class Diamond
what is the actual name of the program (class)?

Explanation

The actual name of the program (class) is "Diamond". This is because in Java, the name of the class should match the name given after the "public class" statement. So, in this case, the name of the class is "Diamond".

Submit
7. A computer keyboard is a:

Explanation

A computer keyboard is classified as an input device because it allows users to input data and commands into a computer system. It consists of various keys that can be pressed to type letters, numbers, and special characters. The input from the keyboard is then processed by the computer's operating system or software applications. Keyboards are essential for tasks such as typing documents, sending emails, playing games, and navigating through computer interfaces.

Submit
8. The line of Java code below has the last character missed.

answer = number1 + 3

The missed character is:

Explanation

The missing character in the given line of Java code is a semicolon (;). A semicolon is used to indicate the end of a statement in Java. In this code, the semicolon is missing after the expression "number1 + 3", which is a syntax error. Adding the semicolon at the end will correct the code.

Submit
9. The text below is a fragment of a Java code.

public class CalcNum {
public static void main(String[] args) {
double circ = 0


This code should be saved as:

Explanation

The correct answer is "CalcNum.java" because the code is defining a public class called "CalcNum" and the convention in Java is to save a public class in a file with the same name as the class, followed by the ".java" extension.

Submit
10. An integer is:

Explanation

The correct answer is any whole number (includes positive, negative, and zero). This is because an integer is defined as a number that does not have a fractional or decimal part. It can be positive, negative, or zero, but it must be a whole number.

Submit
View My Results

Quiz Review Timeline (Updated): Jan 17, 2024 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jan 17, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 05, 2009
    Quiz Created by
    Teacherv
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
To make variable "dat" equal to 5 ...
To make a Java program print "Java", which of the following lines of...
A program "class SavProg2" should be saved as:
Which character usually ends up a Java program code?
You cannot compile your Java program until you
A Java class code contains the following ...
A computer keyboard is a:
The line of Java code below has the last character missed.answer =...
The text below is a fragment of a Java code. public class CalcNum...
An integer is:
Alert!

Advertisement