CSCI 1301 Introduction to Programming
Armstrong Atlantic State University
Instructor: Dr. Y. Daniel Liang
I pledge by honor that I will not discuss this exam with anyone until my
instructor reviews the exam in the class. Signed by ___________________.
Part I.
(a) (3 pts) If you enter input 9, show the output of the following code:
import java.util.Scanner;
public class Test {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print(“Enter an integer: “);
int number = input.nextInt();
int i;
(b) (2 pts) Show the output of the following code:
public class Test {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
System.out.print((i + 4) + “ “);
}
}
}