Question: Java MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question 1) Which of the following statement prints smithexam1test.txt? 1)

Java

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question

1) Which of the following statement prints smith\exam1\test.txt? 1) A) System.out.println("smith"\exam1"\test.txt"); B) System.out.println("smith\exam1\test.txt"); C) System.out.println("smith\\exam1\\test.txt"); D) System.out.println("smith\"exam1\"test.txt"); 2) An int variable can hold ________. (Choose all that apply.) 2) A) 120 B) 120.0 C) "x" D) "120" E) 'x' 3) Suppose x is 1. What is x after x-= 1? 3) A) 0 B) 1 C) 2 D) -1 E) -2 4) What is y displayed in the following code? public class Test { public static void main(String[ ] args) { int x= 1; int y= x+++ x; System.out.println("y is "+ y); } } 4) A) y is 1. B) y is 4. C) y is 2. D) y is 3. 5) According to Java naming convention, which of the following names can be variables? (Choose all that apply.) 5) A) findArea B) TOTAL_LENGTH C) FindArea D) totalLength E) class 1 6) What is y displayed in the following code? public class Test1 { public static void main(String[ ] args) { int x= 1; int y= x= x + 1; System.out.println("y is "+ y); } } 6) A) y is 2 because x + 1 is assigned to x and then x is assigned to y. B) y is 1 because x is assigned to y first. C) y is 0. D) The program has a compile error since x is redeclared in the statement int y= x = x+ 1. 7) What is the printout of System.out.println('z'- 'a')? 7) A) z B) a C) 25 D) 26

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!