Exam 4: Fundamental Data Types
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Which of the following statements about constants in Java are true?
I. Although not required, constants are commonly named using uppercase letters
II. Only integer values can appear as constants
III. A variable can be defined with an initial value, but the reserved word final prevents it from being changed
IV. A named constant makes computations that use it clearer
Free
(Multiple Choice)
4.8/5
(32)
Correct Answer:
C
Assuming that the user inputs a value of 25000 for the pay and 10 for the bonus rate in the following code snippet, what is the output? public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Enter the pay: ");
Double pay = in.nextDouble();
System.out.print("Enter the bonus rate: ");
Double bonus = in.nextDouble();
System.out.println("The new pay is " +
(pay + pay * (bonus / 100.0)));
}
Free
(Multiple Choice)
4.9/5
(32)
Correct Answer:
C
The typical ranges for integers may seem strange but are derived from
Free
(Multiple Choice)
4.7/5
(38)
Correct Answer:
D
Which one of the following statements displays the output as 54321.00?
(Multiple Choice)
4.9/5
(35)
What is the value inside the value variable at the end of the given code snippet? public static void main(String[] args)
{
Int value = 3;
Value = value - 2 * value;
Value++;
}
(Multiple Choice)
4.8/5
(36)
What is the output of the following code snippet? public static void main(String[] args)
{
Double a;
A = Math.sqrt(9.0) + Math.sqrt(16.0);
System.out.println(a);
}
(Multiple Choice)
4.8/5
(41)
What does the following statement sequence print? String str = "Hello";
Int n = str.length();
String mystery = str.substring(0, 1)
+ str.substring(n - 2, n + 1);
System.out.println(mystery);
(Multiple Choice)
4.9/5
(49)
What is wrong with the following code snippet?
Int price;
Price = 9.42;
(Multiple Choice)
4.8/5
(42)
What will be the value inside the variables x and y after the given set of assignments?
Int x = 20;
Int y = 10;
X = (x - y) * 2;
Y = x / 2;
(Multiple Choice)
4.9/5
(40)
Which one of the following is a correct representation of the given mathematical expression in Java? a + b
2
(Multiple Choice)
4.7/5
(36)
Assume the variable str has been declared to be a String that has at least one character. Which is the following represents the last character in str?
(Multiple Choice)
4.9/5
(33)
Which of the given System.out.print statements generates the following output? ABCDE"\
(Multiple Choice)
4.9/5
(26)
What is the output of the following code snippet? public static void main(String[] args)
{
Int num1 = 10;
Int num2 = 5;
Int num3 = 200;
Num3 = num3 % (num1 * num2);
System.out.println(num3);
}
(Multiple Choice)
4.9/5
(29)
What will be the value inside the variables a and b after the given set of assignments?
Int a = 20;
Int b = 10;
A = (a +B) / 2; b = a;
A++;
(Multiple Choice)
4.8/5
(43)
Assume the following variable has been declared and given a value as shown: String str = "0123456789";
Which is the value of str.length()?
(Multiple Choice)
4.8/5
(27)
What (if any) type of error occurs with the following code if the user input is ABC? public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Enter a number: ");
String str = in.next();
Int count = Integer.parseInt(str);
System.out.println("Input is " + count);
}
(Multiple Choice)
4.9/5
(35)
What will be printed by the statements below?
Int x = 100;
Int y = -12;
System.out.print ("Sum is " + x + y);
(Multiple Choice)
4.8/5
(38)
Which of the following statements is correct about constants?
(Multiple Choice)
4.9/5
(36)
Suppose a phone number, stored as a ten-character string (of digits only) called phoneNumber must be converted into a string that has parentheses around the area code. Which statement below will do that?
(Multiple Choice)
4.9/5
(37)
Showing 1 - 20 of 125
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)