10/29/2013

BCS2233 OOP : Ujian 1

Cadangan Ujian 1 satu adalah seperti berikut:-
Tarikh: 13/11/2013 (Rabu)
Masa: 8:30 MALAM
Tempat: THRT A


Topik dan format adalah seperti berikut:-
Chapter 1
1.1 Describe the history of Java. Can Java run on any machine? What is needed to run Java on a computer?
1.2 What are the input and output of a Java compiler?

1.3 Explain the Java keywords. List any five Java keywords
1.4 Is Java case-sensitive?
1.5 What is the Java source filename extension, and what is the Java bytecode filename extension?
1.6 What is a comment? What is the syntax for a comment in Java? Is the comment ignored by the compiler?

Chapter 2

2.1 Translate the following pseudocode into Java code:

Step 1: Declare a double variable named MILES with initial value 1000;


Step 2: Declare a double constant named MILE_TO_KILOMETER with value 1.609;


Step 3: Declare a double variable named KILOMETER, multiply miles and MILE_TO_KILOMETER and assign the result to kilometer;


Step 4: Display kilometer to the console.


2.2 Identify and fix the errors in the following code:
 1 public class Test {
 2   public void main(string[] args) {
 3     int i;
 4     int k = 100.0;
 5     intj = i + 1;
 6
 7     System.out.println("j is " + j + " and
 8       k is " + k);
 9   }
10 }


chapter 3

Suppose x = 3 and y = 2, show the output, if any, of the following code. What is the output if x = 3 and y = 4? What is the output if x = 2 and y = 2? Draw a flowchart of the following code:
if (x > 2) {
  if (y > 2) {
    int z = x + y;
    System.out.println("z is " + z);
  }
}
else
  System.out.println("x is " + x);



Chapter 4

4.1 Convert the following for loop statement to a while loop and to a do-while loop:

long sum = 0;
for (int i = 0; i <= 1000; i++)
  sum = sum + i;


Programming

Write an algorithma and java program for each of the following problems:-

1. Write a program to continuously read in integers and stop when a negative number is entered. 
2. Write a program that prompts the user to enter the number of students and each student's name and score, and finally displays the student with the highest score.


No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...