quiz1 - 1.00 Introduction to Computers and Engineering...

Info iconThis preview shows pages 1–4. 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 4, 2005 Name: E-mail Address: TA: Section: You have 80 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. 1 / 9
Background image of page 1

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

View Full DocumentRight Arrow Icon
Question 1. True/False Answer the following questions about Java by circling TRUE or FALSE as appropriate. 1) Two classes in the same package can access each other's private variables as object.variableName, where object is an instance of the other class, and variableName is a private variable of that object T R U E F A L S E 2) The following piece of code will compile double a = 5.5; double b = 6.9; int sum = a+b; TRUE FALSE 3) Consider the following lines of code int i=6; int j=5; double result = i/j + i%j; The value stored in variable result is 2.2 TRUE FALSE 4) A class constructor may return an int TRUE FALSE 2 / 9
Background image of page 2
Question 2: Methods In the code provided below, MyInt is a class with a single private variable value . Another class Tools has a static method addIt() which adds two integers, stores the value as an object of type MyInt and returns the MyInt object. The class Test contains a main method.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 9

quiz1 - 1.00 Introduction to Computers and Engineering...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online