Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Practice Exam 3 - Computer Science I - Fall 2007 | CS 1113, Exams of Computer Science

Material Type: Exam; Professor: Chandler; Class: COMPUTER SCIENCE I; Subject: Computer Science; University: Oklahoma State University - Stillwater; Term: Fall 2007;

Typology: Exams

Pre 2010

Uploaded on 03/11/2009

koofers-user-q3p
koofers-user-q3p 🇺🇸

10 documents

1 / 4

Toggle sidebar

Related documents


Partial preview of the text

Download Practice Exam 3 - Computer Science I - Fall 2007 | CS 1113 and more Exams Computer Science in PDF only on Docsity! Print name, family name first: _____________________________ Lab section ______ CS 1113 Exam 3’ 29 November 2007 Closed book exam; calculator and one sheet of notes allowed. You may declare new variables wherever needed. (15) 1. Given the following Java declarations, what numerical result is stored into the variable on the left of the “=” by each of the assignment statements? If there is an error in the statement, write “Error:” and explain what the error is. int iX; double dX; (a) iX = -2 + 19 / 3 * 3 % 5 + 3; (b) iX = (int) 3.9 + 2.0; (c) dX = (11 / (double) 4 * 2.0); (d) iX = 29 / 2 / 3; (e) dX = (double) (27 / 4); (15) 2. What is printed by the following Java program? public class Exam3 { public static void main(String[] args) { int iX = 8; changeIt(iX); System.out.println(iX); } private static void changeIt(int iX) { System.out.println(iX); iX = 7; System.out.println(iX); } } 3. public class Employee has instance variables name (a String) and idNum (an int). Below, write (5) (a) The public class statement and the instance variable statements (5) (b) The constructor (5) (c) An accessor method getNum to get the value of idNum (5) (d) A mutator method setName to change the value of name (5) (e) An equals method
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved