Chapter 2 : Elementary Programming Questions and answers, Graded A+/ 2024/25 Exam PREDICTOR PAPER
15 views 0 purchase
Course
Elementary Programming
Institution
Elementary Programming
Chapter 2 : Elementary Programming
Questions and answers, Graded A+
_______ is the code with natural language mixed with Java code.
A. Java program
B. A Java statement
C. Pseudocode
D. A flowchart diagram - -Pseudocode
What is the exact output of the following code?
double area = 3.5;
S("a...
Chapter 2 : Elementary Programming
Questions and answers, Graded A+
_______ is the code with natural language mixed with Java code.
A. Java program
B. A Java statement
C. Pseudocode
D. A flowchart diagram - ✔✔-Pseudocode
What is the exact output of the following code?
double area = 3.5;
System.out.print("area");
System.out.print(area);
A. 3.53.5
B. 3.5 3.5
C. area3.5
D. area 3.5 - ✔✔-area3.5
,Suppose a Scanner object is created as follows, what method do you use to read a real number?
Scanner input = new Scanner(System.in);
A. input.nextDouble();
B. input.nextdouble();
C. input.double();
D. input.Double(); - ✔✔-input.nextdouble();
The following code fragment reads in two numbers:
Scanner input = new Scanner(System.in);
int i = input.nextInt();
double d = input.nextDouble();
What is the incorrect way to enter these two numbers?
A. Enter an integer, a space, a double value, and then the Enter key.
B. Enter an integer, two spaces, a double value, and then the Enter key.
C. Enter an integer, an Enter key, a double value, and then the Enter key.
D. Enter a numeric value with a decimal point, a space, an integer, and then the Enter key. - ✔✔-Enter a
numeric value with a decimal point, a space, an integer, and then the Enter key.
If you enter 1 2 3, when you run this program, what will be the output?import java.util.Scanner;
, public class Test1 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter three numbers: ");
double number1 input.nextDouble();
double number2 = input.nextDouble();
double number3 = input.nextDouble();
// Compute average
double average = (number1 + number2 + number3) / 3;
// Display result
System.out.println(average);
}
}
A. 1.0
B. 2.0
C. 3.0
D. 4.0 - ✔✔-2.0
Every letter in a Java keyword is in lowercase?
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller PassPoint02. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $10.49. You're not tied to anything after your purchase.