0% found this document useful (0 votes)
2 views2 pages

Quiz I (Section I - Solution)

This document is a quiz for the Engineering Programming course at Lebanese American University, focusing on Java programming concepts. It includes multiple-choice questions about Java file extensions, string instantiation, output statements, and code evaluation. The quiz tests students' understanding of Java syntax and behavior.

Uploaded by

mannblanc53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Quiz I (Section I - Solution)

This document is a quiz for the Engineering Programming course at Lebanese American University, focusing on Java programming concepts. It includes multiple-choice questions about Java file extensions, string instantiation, output statements, and code evaluation. The quiz tests students' understanding of Java syntax and behavior.

Uploaded by

mannblanc53
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

LEBANESE AMERICAN UNIVERSITY

Electrical and Computer Engineering Dept

COE 212
Engineering Programming (Section I)
Spring 2014
W. FAWAZ

Quiz I
Problem I

1) The .java extension on a file means that the file


a. contains Java byte code
b. is produced by the Java interpreter
c. is produced by the Java compiler
d. None of the above

2) Which of the following is not a proper way to instantiate a String object?


a. String str = new String(“Java is fun”);
b. String str = “Java is fun”;
c. All of the above
d. None of the above

3) Consider the following Java statements:


String str1;
String str2 = “Quiz is fun”;
Which of the following can be used to store the value of the variable called
str2 in str1?
a. str2 = str1;
b. str1 = str2 + “”;
c. All of the above
d. None of the above

4) If you want to output the text ‘hi there’, include the single quote marks,
which of the following could do that?
a. System.out.print(“‘hi there’”);
b. System.out.print(“\‘hi” + “there’\”);
c. System.out.print(“\‘hi” + “there\’”);
d. None of the above

5) What output is produced by the following statement?


System.out.print(“” + 10 + 5);
a. 15
b. 105
c. 10 5
d. None of the above
Problem II

1. The output of the following statements is: 100 Done


int y = 10, z =0;
System.out.print(“” + z + y + “ Done”);
Answer: True False

2. The following two ways of setting up a String yield identical results


a) String str = “12345”;
b) String str = “1” + “2” + 3 + ‘45’;
Answer: True False

3. The output of the following code fragment is: quiz is fun


String quiz = “Quiz”; String isFun = “ is fun”;
System.out.print(“quiz” + isFun);
Answer: True False

4. After running the code shown below, the value stored in the variable y is 13
int y = 7;
y = --y + y;
Answer: True False

5. The output of the following statement is: 4.5


System.out.print((double) (9/2));
Answer: True False

You might also like