Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 29 pages
Exam (elaborations)

Chapter 2 : Elementary Programming Questions and answers, Graded A+/ 2024/25 Exam PREDICTOR PAPER

Document preview thumbnail
Preview 3 out of 29 pages

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("area"); S(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(S); A. Double(); B. ouble(); C. e(); D. input.Double(); - -ouble(); The following code fragment reads in two numbers: Scanner input = new Scanner(S); int i = Int(); double d = Double(); 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 .Scanner; public class Test1 { public static void main(String[] args) { Scanner input = new Scanner(S); S("Enter three numbers: "); double number1 Double(); double number2 = Double(); double number3 = Double(); // Compute average double average = (number1 + number2 + number3) /

Content preview

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?

Document information

Uploaded on
December 24, 2023
Number of pages
29
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
CA$15.90

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
PassPoint02
4.1
(39)
Sold
176
Followers
105
Items
4576
Last sold
2 months ago


Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions