subject

Consider the following code segment. boolean a = true;
boolean b = false;
System. out. print((a == !b) != false);
What is printed as a result of executing this code segment?
false
true
0
1
Nothing is printed because the expression (a == !b) != false is an invalid parameter to the System. out. print method.
The following code segment prints one or more characters based on the values of boolean variables b1 and b2. Assume that b1 and b2 have been properly declared and initialized.
if (!b1 || b2)
{
System. out. print("A");
}
else
{
System. out. print("B");
}
if (!(b1 || b2))
{
System. out. print("C");
}
else
{
System. out. print("D");
}
if (b1 && !b1)
{
System. out. print("E");
}
If b1 and b2 are both initialized to true, what is printed when the code segment has finished executing?
ABCD
ABD
AD
BD
BDE
Consider the following code segment.
String str1 = new String("Happy");
String str2 = new String("Happy");
System. out. print(str1.equals(str2) + " ");
System. out. print(str2.equals(str1) + " ");
System. out. print(str1 == str2);
What is printed as a result of executing the code segment?
true true true
true true false
false true false
false false true
false false false
Consider the following two code segments. Assume that variables x and y have been declared as int variables and have been assigned integer values.
I.
int result = 0;
if (x > y)
{
result = x - y;
System. out. print(result);
}
else if (x < y)
{
result = y - x;
System. out. print(result);
}
else
{
System. out. print(result);
}
II.
if (x < y)
{
System. out. print(y - x);
}
else
{
System. out. print(x - y);
}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 00:40
Write a function 'music_func' that takes 3 parameters -- music type, music group, vocalist -- and prints them all out as shown in the example below. in case no input is provided by the user, the function should assume these values for the parameters: "classic rock", "the beatles", "freddie mercury". for example: input: alternative rock,pearl jam,chris cornell output: the best kind of music is alternative rock the best music group is pearl jam the best lead vocalist is chris cornell note: the print statements will go inside the for example: print("the best kind of music is"
Answers: 2
question
Computers and Technology, 22.06.2019 02:30
Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type)] and calculates actual game time (double) based on the following conditions: if the number of players or the expected game time is less than or equal to zero, it should output wrong input if the number of players is greater than 0 and less than or equal to 6 and if they are on the â€r’ or â€r’ team, their game time will be 10% faster. and if they are on the â€b’ or â€b’ team, their game time will be 15% faster. and if they are on the â€y’ or â€y’ team, their game time will be 20% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 6 but less than or equal to 12 and if they are on the â€r’ or â€r’ team, their game time will be 20% faster. and if they are on the â€b’ or â€b’ team, their game time will be 25% faster. and if they are on the â€y’ or â€y’ team their game time will be 30% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 12 but less than or equal to 18 and if they are on the â€r’ or â€r’ team, their game time will be 30% faster. and if they are on the â€b’ or â€b’ team, their game time will be 35% faster. and if they are on the â€y’ or â€y’ team, their game time will
Answers: 2
question
Computers and Technology, 22.06.2019 13:30
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
question
Computers and Technology, 23.06.2019 01:10
Are special combinations of keys that tell a computer to perform a command. keypads multi-keys combinations shortcuts
Answers: 1
You know the right answer?
Consider the following code segment. boolean a = true;
boolean b = false;
System. out....
Questions
question
Mathematics, 19.11.2020 22:10
question
Mathematics, 19.11.2020 22:10
question
Business, 19.11.2020 22:10
question
Social Studies, 19.11.2020 22:10
question
Health, 19.11.2020 22:10
Questions on the website: 13722359