{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

quiz1bsol_sprng3

quiz1bsol_sprng3 - 1.00 Introduction to Computers and...

Info icon This preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to include comments, and you should assume that all necessary files have already been imported. Good luck. Question Points Question 1 / 15 Question 2 / 15 Question 3 / 20 Question 4 / 50 Total / 100 1.00 Spring 2003 Quiz 1 1/7 2/6/2004
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Problem 1. (15 points) Refer to the following code fragment to answer the TRUE or FALSE statements as appropriate: public class Quiz1 { private double quizAvg; public static void main(String[] args) { int i = 2; double d = Math.pow(36, 1/i); System.out.println(d); float k = i; for (i=0; i<5; i++) { //outer for loop for (int j=0; j<5; j++) { //inner for loop if (j==2) { break; } } } } public Quiz1(double q) {quizAvg= q:} } a. The program above outputs the value 6.0 . TRUE FALSE b. The statement float k = i; is a legal statement. ( I.e. , it will compile and run.) TRUE FALSE c. When j is equal to 2, the break statement forces the main method to quit the outer for loop and to proceed with the statement after the break . TRUE FALSE d. String is a Java primitive data type. TRUE FALSE e. The Quiz1 class has one constructor. In general, a class can have more than one constructor.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern