Answer:
int age = 10;
switch (age){
case 0:
case 1:
System.out.println("ineligible");
break;
case 2:
System.out.println("toddler");
break;
case 3:
case 4:
case 5:
System.out.println("early childhood");
break;
case 6:
case 7:
System.out.println("young reader");
break;
case 8:
case 9:
case 10:
System.out.println("elementary");
break;
case 11:
case 12:
System.out.println("middle");
break;
case 13:
System.out.println("impossible");
break;
case 14:
case 15:
case 16:
System.out.println("high school");
break;
case 17:
case 18:
System.out.println("scholar");
break;
default:
System.out.println("ineligible");
}
Explanation:
In java and many other programming languages, a switch statement is a way of having multiple branching options in a program. This is usually considered a more efficient way than using multiple if....else if statements. and the expression variables could be byte, char int primitive data types. etc. every branch (option) in a switch statement is followed by the break statement to prevent the code from "falling through". In the question The variable age is declared as an int and initialized to 10. and tested against the conditions given in the question.
<span>public static int methodName(int a, int b){
a = a * 2;
b = b * 2;
}
</span><span>int result = doubling(5, 10<span>);
System.out.println(result);
//result would be 10, 20</span></span>
Answer:
var birthday = "12/2/1978";
Explanation:
It does not create a date object named birthday because in this statement the birthday is a string which contains 12/2/1978 a date it is not date object it is a string.All other three options are correct way to create a date object.
var birthday = new Date();
creates a date object with the current date and time.
we can also pass date string in the new Date().So var birthday = new Date("12/2/1978"); is also correct.
we can also pass year,month,day in new Date() In this order only.So option fourth is also correct.
Answer:
All four questions are explained below :
Explanation:
- The types of programming language are: Procedural Programming Language, Functional Programming Language
, Object-oriented Programming Language, Scripting Programming Language,Logic Programming Language. For example: C, C++, Java, FORTRAN, PHP language etc.
- Imperative language means code is executed line by line, in sequence. And declarative language means that the program itself specifies what next is to be done not how it is done.
- One line of 2nd generation is equivalent to one line of object code.
- One line of 3rd generation is equivalent to many lines of object code.