please each of these multiple choices and questions one afte
please each of these multiple choices and questions one after another.
2.
3.
4.
5.
6.
7.
8.
9.
10.
Solution
Ans)
1) d. True or false
2) a. a>b
3) a. 10
4. e. none of the above
Does not enter in to if loop as score = 0
5. c. If(code == \'C\')
WriteLine(\"This is a check\");
6. b. You passed the test!
7. c. &&
8. b. Used as a part of assignment statement
9. a. Detracts from readibility
10. d. 1 1
11. b. AND
12. c. never
because there should not be semicolon to the if loop.
13. d. 27
Exp:
public class Test
{
public static void main(String[] args)
{
int x=9;
int y = 3;
if(x>y)
if(y>0){
x=x*y;
System.out.println(\"11111 \"+x);
}
else if(y<4){
x = x-y;
System.out.println(\"222 \"+x);
}
}
}
14. b.10
given inputvalue = 3;
as it is greater than 2 inputvalue is assigned to 10
15. a. paranthesis
16. d. blue,blue, sail on through , Green , green , nice and clean
17. b. 1000
Exp:
public class Test
{
public static void main(String[] args)
{
int avalue = 100;int bvalue = 7;
int result = avalue>bvalue -100?1000:2000;
System.out.println(result);
}
}
18. c. if(control == 11)
19. b. Logical OR yeilds true if either or both of its operands are true.
20. c. a and b are correct
21. c. c<=4
22. switch(avalue){
case 100: WriteLine(\"value is 100\");
default: WriteLine(\"Value is lessthan 100\");
}
23. String birdname= owl;
if(birdname == \"felican\"){
WriteLine(\"lives near water\");
}
if(birdname == \"cardinal\"){
WriteLine(\"beautiful in the snow\");
}
if(birdname == \"owl\"){
WriteLine(\"night creatures\");
}
if(birdname == \"Eagle\"){
WriteLine(\"keen vision\");
}
if(birdname == \"Flemingo\"){
WriteLine(\"pretty and pink\");
}
else{
WriteLine(\"can fly\");
}
24.if(avalue > bvalue){
if(bvalue == 10)
WriteLine(\"Test complete\");
}
25. a) if(amountOwned > 1000.00)
WriteLine(\"Overdue message\");
b) if(amountOfRain >5){
total = total + 5;
}else if(amountOfRain >3 && amountOfRain <5){
total = total + 3;
}else if(amountOfRain < 3){
total = total + 1;
}
c)if(middleInitial == \'s\'){
WriteLine(\"you are one in thousand\");
}else {
if(middleInitial == \'a\'){
WriteLine(\"you have a common initial\");
}
}
d)if(balance >100 && transaction<50){
balance = balance - transaction;
}
else if(balance < 100){
balance = balance + transaction;
}
Excercises:
1. e. none of the above
2. a.To fecilitate sequential processing of data
3. a.foreach
4. d. do..while
5. c.while
6. d.continue
7. b.while(counter<10)
8. e. none of the above


