subject
Computers and Technology, 13.10.2019 08:10 ur4286

9. consider the following code.
int x = 2;
switch (x) {
case 1: x += 3;
case 2: x += 5;
case 3: x += 7;
default: x += 10;
}
which syntax correctly prints an array?
for (int n = 1; n < = x. length; n++) {
system. out. println(x[n]);
}
for (int n=0; n < = x. length; n++) {
system. out. println(x[n]);
}
for (int n = 1; n < x. length; n++) {
system. out. println(x[n]);
}
for (int n=0; n < x. length; n++) {
system. out. println(x[n]);
}
10. consider the following declaration.
int[] two = {{1,2,3}, {4,5}};
which arithmetic expression evaluates to a value of 8?
two[3] + two[2]
two[2] + two[1]
two[1][3] + two[2][2]
two[0][2] + two[1][1]
11. consider the following method.
public static void print (int a, int b) {
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?
system. out. println(print(2,3));
system. out. println(print(2 + 3));
print(2, 3);
print(2 + 3);

12. which of the following expressions correctly and most accurately calculates the area of a circle with radius r?
math. pow(r, 2) * math. pi
math. power(r,2) * math. pi
math. pow(2, r) * math. pi
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?
amazing a = new amazing;
amazing a = new amazing();
amazing a = amazing();
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 that will be assigned to its instance variables?
public employee() {
firstname = "fred";
lastname = "jones";
empid = 101;
}
public employee(string a, string b, int c) {
firstname = a;
lastname = b;
empid = c;
}
public employee("fred", "jones", 101) {
firstname = a;
lastname = b;
empid = c;
}
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);
true, true
true, false
false, true
false, false

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:00
Let r be a robotic arm with a fixed base and seven links. the last joint of r is a prismatic joint, the other ones are revolute joints. give a set of parameters that determines a placement of r. what is the dimension of the configuration space resulting from your choice of parameters?
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Research data that is presented using descriptive language is said to be
Answers: 2
question
Computers and Technology, 23.06.2019 08:00
The managing director of a company sends a christmas greeting to all his employees through the company email. which type of network does he use? he uses an .
Answers: 3
question
Computers and Technology, 23.06.2019 14:30
Select the correct answer. which step can possibly increase the severity of an incident? a. separating sensitive data from non-sensitive data b. immediately spreading the news about the incident response plan c. installing new hard disks d. increasing access controls
Answers: 2
You know the right answer?
9. consider the following code.
int x = 2;
switch (x) {
case 1: x += 3;
...
Questions