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 12:00
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
question
Computers and Technology, 24.06.2019 00:10
Read each statement below. if the statement describes a peer-to-peer network, put a p next to it. if the statement describes a server-based network, put an s next to it. p - peer-to-peer s - server-based
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
Which explains extrinsic motivation? a)motivation in which there is a reward b)motivation that is personally satisfying c)motivation that is personally meaningful d)motivation in which the subject is interesting
Answers: 1
question
Computers and Technology, 24.06.2019 15:30
George is working as a programming team lead. which statements correctly describe the skills that he requires?
Answers: 3
You know the right answer?
9. consider the following code.
int x = 2;
switch (x) {
case 1: x += 3;
...
Questions
question
Mathematics, 13.07.2019 15:30
question
Mathematics, 13.07.2019 15:30
question
Mathematics, 13.07.2019 15:30
question
Mathematics, 13.07.2019 15:30
question
Physics, 13.07.2019 15:30
Questions on the website: 13722361