October 11, 2023
October 11, 2023
October 11, 2023
###### UGC NET CS 2010 Dec-Paper-2
October 11, 2023
 Question 11
How many of the following declarations are correct ?
int z = 7.0;
double void = 0.000;
short array [2] = {0, 1, 2};
char c = “\n”;
 A None B One is correct C Two are correct D All four are correct
Question 11 Explanation:
int z = 7.0; → Incorrect. Given data type is integer but given floating point number.
It is wrong declaration.
double void = 0.000; → Incorrect. void is a keyword but can’t use with variable declaration.
It always return null value.
short array [2] = {0, 1, 2}; → Correct. It is right format. We can declare static values here itself.
char c = “\n”; → Incorrect. It is character data type but given in double quotes. It should be single quote instead of double quote.
Question 11 Explanation:
int z = 7.0; → Incorrect. Given data type is integer but given floating point number.
It is wrong declaration.
double void = 0.000; → Incorrect. void is a keyword but can’t use with variable declaration.
It always return null value.
short array [2] = {0, 1, 2}; → Correct. It is right format. We can declare static values here itself.
char c = “\n”; → Incorrect. It is character data type but given in double quotes. It should be single quote instead of double quote.