Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Language Syntax. Multiple Choice 1. Remarks (Commants) containing more than

ID: 3683903 • Letter: J

Question

Java Language Syntax. Multiple Choice

1. Remarks (Commants) containing more than one sentence should be coded in Java:

a. between double quotes
b. after \
c. between /* and /*
d. between * and *
e. none of the above

2. ______________ invokes the module named rptOut.

a. rptOut!
b. rptOut();
c. Call rptOut.
d. invoke rptOut
e. none of the above

3. What data type does the Java readLine() method input?

a. String
b. decimal
c. integer
d. character
e. none of the above

4. In Java the following statement will output the label "Cost is:  " and the decimal cost.

a. System.out.println("cost" + Cost is);
b. System.out.Output("Cost is: " + cost);   
c. System.out.println("Cost is: " + cost);
d. System.out print("Cost is: + cost");
e. none of the above

5. To assign the value in profit to the variable max_profit in Java use ____________.

a. max_profit = profit;
b. max_profit equals profit;
c. max_profit == profit;
d. profit = max_profit;
e. none of the above

6. Which of the following conditions would have a true value when profit and 666 are equal in Java?

a. (profit equals 666)
b. (profit == 666)
c. (profit != 666)
d. (profit = 666)
e. none of the above

7. Which of the following conditions would have a true value when profit and 666 are unequal in Java?

a. (profit equals 666)
b. (profit == 666)
c. (profit != 666)
d. (profit = 666)
e. none of the above

8. In Java, iteration can be accomplished using a(n) ______________ statement.

a. while
b. until
c. if
d. all of the above
e. none of the above

9. What is the value of k after execution of the java instruction while(k <= 5){k = k + 1;} given that k = 0 initially ?

a. 0
b. 1
c. 5
d. 6
e. none of the above

10. What is the value of k after execution of the java instruction if(k <= 5){k = k + 1;} given that k = 0 initially ?

a. 0
b. 1
c. 5
d. 6
e. none of the above

Explanation / Answer

1.
Ans: e
   explanation: correct answer is between /* and */
  
2.
   Ans: b. rptOut();
  
3.   Ans: a. String

4.   Ans: c - system.out.println("Cost is:"+cost);

5. Ans: a. mac_profit = profit;

6. Ans: b. (profit == 666)

7. Ans: c. (profit != 666)

8. Ans: a. while

9. Ans: d. 6

10. Ans: b. 1

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote