Question: Question 25 (0.625 points) An example of modularization in Java is Question 25 options: methods calculations the 'new' keyword primitive variables Question 26 (0.625 points)
Question 25 (0.625 points)
An example of modularization in Java is
Question 25 options:
|
| methods |
|
| calculations |
|
| the 'new' keyword |
|
| primitive variables |
Question 26 (0.625 points)
Which statement correctly creates a new object from the class Abcd using the no-parameter constructor and assigns it to a variable?
Question 26 options:
|
| String e = new Abcd(); |
|
| Abcd e = Abcd(); |
|
| new Abcd(e); |
|
| Abcd e = new Abcd(); |
Question 27 (0.625 points)
What is the value of num after the following code has executed?
int num = 5; if (num / 4 == 0) { num = num + 2; } else { num = num + 1; } Question 27 options:
|
| 2 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
Question 28 (0.625 points)
Given the class outline below, how would you fill in the constructor in order to initialize the field to the parameter?
public class Nut { private String type; public Nut(String type) { // what goes here? } } Question 28 options:
|
| type = newType; |
|
| type = Nut; |
|
| type = this.type; |
|
| this.type = type; |
|
| type = type; |
Question 29 (0.625 points)
In Java, 'overloading' refers to
Question 29 options:
|
| storing too large a value in a numeric data type |
|
| repeatedly overwriting the contents of a variable |
|
| creating an object that is too large to be stored in the space available |
|
| multiple methods with the same name |
Question 30 (0.625 points)
The result of the expression 9 % 3 would be
Question 30 options:
|
| 0 |
|
| 1 |
|
| 2 |
|
| 3 |
|
| It would cause an error |
Question 31 (0.625 points)
What line should go in the body of the method so that it returns twice the parameter value? (For example, if n is 6, the method should return 12.)
public int twice(int n) { } Question 31 options:
|
| return n * 2; |
|
| twice = n * 2; |
|
| return n; |
|
| n * 2 |
Question 32 (0.624 points)
Given this method signature:
public void someMethod(int param1, String param2)
Which statement correctly calls the method from within the same class?
Question 32 options:
|
| int x = someMethod("abc", 5); |
|
| int x = someMethod(5, "abc"); |
|
| someMethod(); |
|
| someMethod(5, "abc"); |
|
| someMethod("abc", 5); |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
