13) Of the following types, which one cannot store a numeric value? A) int B) by
ID: 3590071 • Letter: 1
Question
Explanation / Answer
13)
Answer : Option 'e' (All of these can store numeric values)
Explanation : All the above data types can store a numeric value. Eg int a=10 , float b=10 etc
14)
Answer : Option 'a' (z will equal 0.0)
Explanation : Since, 5 and 10 integers, integer division takes place, hence the result would be 0. Since, the variable is of type float, it would be converted to floating point number and hence the result would be 0.0
15)
Answer : Option 'b' (105)
Explanation : "+x+y will be executed as ("+x)+y. Hence, the result of "+x would be string "10" and then, x+y would be "10"+5 since "10" is of type string , then string conactenation takes place and the output would be "105".
16)
Answer : Option 'e' (Any of the above would work)
Explanation : All are valid statements
17)
Syntax Error : int a=10 (ERROR : ';' is missing)
Logical Error : int a = true; (ERROR : incompatible types)
Runtime Error : int a = 5/0 (ERROR : division by 0 throws an exception)
18)
public class PrintStars{
public static void main(String args[])
{
System.out.println("*");
System.out.println("* * *");
System.out.println("* * * * *");
}
}
19)
Answer : Option 'd' (final)
Explanation : "final" keyword is used to create a constant and it's value cannot be changed
20)
Answer : Option 'd' (final)
Explanation : "final" keyword is used to create a constant and it's value cannot be changed
21)
Answer: Option 'a' (0)
22)
Answer : Option 'd'
Explanation : The program is executed in thee main memory(RAM).
24)
Answer : Option 'c' (boolean b3= false;)
25)
Answer : Option 'c' (32)
Explanation : ++g is preincrement operator and hence ++g evaluates to ++3 =4 and then 4*8 happens. Hence answer = 32.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.