Java Programming

1. What is Java SE?

A. Java Standard Edition*
B. Java Software Editor
C. Java Scientific Edition
D. Java Software Emulator

2. Which of the following is the correct header for the main method of a Java program?

A. public static void main(String args)
B. public abstract void main(String[] args )
C. public static void main(String[] args )*
D. public static int main(String[] args )

3. Which of the following statements creates a constant in Java?

A. int const = 5;
B. const int x = 5;*
C. final int x = 5;
D. const x = 5;

4. Which of the following statements displays 17?

A. System.out.println (2*4+3*2+1);*
B. System.out.println ((2*4+3)*2+1);
C. System.out.println (2*4+(3*(2+1)));
D. System.out.println (2*(4+3*2)+1);

If x is an int and the original value of x is 5, which of the following statements assigns an even value to x?

5.

A. x += 2;
B. x /= 3;*
C. x %= 3;
D. x *= 3;

6. If x is an int, Which expression will always evaluate to true if x is evenly divisible by 5

A. x == 5*
B. x % 2 == 5
C. x % 2 == 0
D. x % 5 == 0

7. Consider the following directions.

int y = 5;
int z = 10;

Which of the following expressions evaluates to true?

A. y > 5 && z >= 10
B. z / y >= 2 && y * 2 > z
C. y - z >0 || y * 4 == z * 2*
D. y + z == z + y && z - y == y - z

8. Consider the following code.

int x = 2.
switch (x) {
case 1: x += 3;
case 2: x += 5;
case 3: x += 7;
default: x += 10;
}

After the switch statement, what is the value of x?

A. 2
B. 5
C. 7
D. 24*

9. If y refers to an array of int values with seven elements, and all of those elements have been given a value of 5, which statement would change the last element of a 2?

A. y {7] = 2
B. y [6] = 2
C. y [2] = 6*
D. y [2] = 7

10. Consider the following declaration.

int [] two = {{1, 2, 3}, {4, 5}};

Which arithmetic expression evaluates to a value of 8?

A. two[3] + two[2]
B. two[2] + two [1]
C. two[1] [3] + two[2] [2]
D. two[0] [2] + two[1] [1]*

11. Consider the following method.

public static void print (int a, int ) {
System.out.println ("The sum is" + (a+b));
}

If the print method is in the same class as the main method and there are no other methods named print, which of the following statements, called from the main method, will not cause a compiler error?

A. System.out.println (print (2, 3));
B. System.out.println (print (2 + 3));
C. print (2, 3);*
D. print (2 + 3);

12. Which of the following expressions correctly and most accurately calculates the area of a circle with radius r?

A. Math.pow (r, 2) * Math.PI*
B. Math.power (r, 2) * Math.PI
C. Math.pow (2, r) * Math.PI
D. Math.exp (r, 2) * Math.PI

13. Consider the following code.

public class Amazing {
int x;
int y;
}

Which of the following shows a statement that will create an instance of class Amazing and assign its reference to a reference variable?

A. Amazing a = new Amazing;
B. Amazing a = new Amazing ();
C. Amazing a = Amazing ();
D. It is not possible to create an instance of class Amazing. It does not have a constructor.*

14. Consider the following code.

public class Employee () {
private String firstName;
private String lastName;
private int empId;
}
Which of the following shows a constructor that, if added to class Employee, would allow a caller to create an object and pass in values from the call that will be assigned to its instance variables?

A. public Employee () {
firstName = “Fred”;
lastName = “Jones”;
empId = 101;
}

B. public Employee (String a, String b, int c) {
firstName = a;
lastName = b;
empId = c;
}

C. public Employee (“Fred”, “Jones”, 101) { *
firstName = a;
lastName = b;
empId = c;
}

D. public Employee (String a, String b, int c) {
firstName = “Fred”;
lastName = “Jones”;
empId = 101;
}

15. What is the output of the following code?

String name1 = “Chris”;
String name2 = “Christine”;
boolean b = name1 . startsWith (name2);
boolean c = name1 . charAt (4) == name2 . CharAt (7);
System.out.println (b + “, ” + c);

A. true, true
B. true, false
C. false, true
D. false, false*

Note * means my answer

  1. 👍
  2. 👎
  3. 👁
  1. my mans just asked for the entire Java Programming 1 Review Quiz

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. Java

    write a java program to read a record name, age, and salary. Calculate the tax amount on the salary field display the new record.

  2. Java Programming

    Question : Write a java program to find circumference and area of a circle. Your program should be fulfill following requirements.  Radius of the circle should be read in the main method of the program  Circumference and

  3. Java

    create a java program that accepts students names, and test scores from a file, and displays theri name, average score and letter grade to the screen.

  4. java

    PLZ HELP ASAP 1. What is Java SE? A. Java Standard Edition B. Java Software Editor C. Java Scientific Edition D. Java Software Emulator 2. Which of the following is the correct header for the main method of a Java program? A.

  1. java programming

    write a java program using arrays function for hotel bill calculation?

  2. Computers

    Which of the following is not found in the header of a Java method A. a return type B. a parameter list C. modifiers D. statements

  3. computer science

    Who invented Java?

  4. algebra 1

    the deepest point in elevation in the indian ocean is the java trench, which is 25,344 feet below sea level. elevations below sea level are represented by negative numbers. can you help write the elevation of the Java Trench?

  1. programming

    in java code what are the differences between 2, 2.0, '2', "2", and "2.0"

  2. java programming

    What is the name of the Java class used to create an object that reads input from the keyboard?

  3. programming

    java, write a program that prints out the letter X composed of asterisks (*) reply soon

  4. vembadi girls high school

    Write a java program to store n numbers an array and find the smallest number among them (using array )

You can view more similar questions or ask a new question.