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, 22.06.2019 19:00
In he example code, what does the title attribute create? a tool tip an element a source a markup
Answers: 1
question
Computers and Technology, 23.06.2019 03:50
Q-1 which of the following can exist as cloud-based it resources? a. physical serverb. virtual serverc. software programd. network device
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
For positive constants a and b, the force between two atoms in a molecule is given f(r) = −a r2 + b r3 , where r > 0 is the distance between the atoms. note: a and b are upper case letters. (a) find f '(r) = (b) find the critical point for f(r). r = (c) find f ''(r) = (d) find the value of r so that f ''(r) = 0.
Answers: 1
You know the right answer?
9. consider the following code.
int x = 2;
switch (x) {
case 1: x += 3;
...
Questions
question
Computers and Technology, 26.01.2021 17:00
question
Business, 26.01.2021 17:00
question
Mathematics, 26.01.2021 17:00
question
Mathematics, 26.01.2021 17:00
Questions on the website: 13722363