NEW
Font size
WorksheetsICSE JAVA
Total questions: 61
Worksheet time: 31mins
Java was designed by _________________.
Microsoft
Mozilla Corporation
Sun Microsystems
Amazon Inc.
Earlier name of Java Programming language was -
Eclipse
OAK
Netbean
C
Which kind of language java is ?
Object Oriented
Procedural
Event Driven
None of these
Which of the following are correct advantage of java?
Java is Simple
Java is Secure
Java is Portable
All of the above
Default, public , protected, private are?
Access Modifier
Non-access Modifiers
Both A and B
It's variable
Single line comment starts with _________ in Java.
/**
//
/*
None of these
Java is case sensitive?
True
False
Depends On Compiler
May be true or false
What is true in Java?
For all class names the first letter should be in Upper Case
All method names should start with a Lower Case letter.
Name of the program file should exactly match the class name.
All of the above
All Java components require names. Names used for classes, variables, and methods are called?
Variables
identifiers
Access Modifiers
Java Modifiers
Which of the following is smallest integer data type ?
int
byte
short
long
Which of the following is not a primitive data type ?
byte
enum
short
int
Integer Data type does not include following primitive data type ____________.
long
byte
short
double
Which of the following data types comes under floating data types ?
int
double
long
byte
Character data type cannot store following value.
Digit
Letter
Special Character
String
Range of Byte Data Type is ____________.
-128 to 128
-127 to 127
-127 to 128
-128 to 127
What is size of integer in Java Programming.
1 Byte
2 Bytes
4 Bytes
8 Bytes
Which of the following data type(s) can store 64 bit Value.
boolean
int
float
long
Short data type has a minimum value of _____________.
-32768
-32767
32768
32767
Default value of variable having boolean data type is ___________.
true
false
null
garbage
What will be the output of the program?
class Main
{
void main()
{
int t;
System.out.println(t);
} }
0
garbage value
compiler error
runtime error
What will be the output of the program?
class Test
{
void main()
{ for(int i = 0; 0; i++)
{ System.out.println(""Hello"");
break; } } }
Hello
Empty Output
Compiler error
Runtime error
What will be the output of the program?
0
1
true
false
Predict the output of the following program.
8
8.0
8.800000095
8.0
What is the output of this program?
Infinity
0
NaN
all of the mentioned
What will be the output of the program?
32
36
40
48
What will be the output of the program?
48
40
56
44
n expression involving byte, int, and literal numbers is promoted to which of these?
int
byte
long
float
Which data type value is returned by all transcendental math functions?
int
float
double
long
Which one is a valid declaration of a boolean?
boolean b1 = 1;
boolean b2 = false;
boolean b3 = false;
boolean b4 = true
Which of these can be returned by the operator &?
Integer
Boolean
Character
Integer or Boolean
A ________ provides us with named storage that our programs can manipulate.
data type
constants
operators
variable
Each variable in Java has a specific type, which determines the size and layout of the variable's memory.
TRUE
FALSE
Can be true or false
Can not say
To declare more than one variable of the specified type, we can use a comma-separated list.
colon-separated
bracket-separated
comma-separated
None of the above
How many kinds of variables in Java?
2
3
4
5
Local variables are declared in?
methods
constructors
blocks
All of the above
What is true about Instance Variables in java?
Instance variables are declared in a class B
When a space is allocated for an object in the heap, a slot for each instance variable value is created.
Instance variables can be declared in class level before or after use
All of the above
Which variables have no default values?
Static Variables
Instance Variables
Local Variable
Both A and B
Static variables can be accessed by calling with the?
Object name
Class name
Function name
Can not say
Which of the following is an Example of variable initialization?
int a, b, c;
int a = 10, b = 10;
int 10 = a;
None of the above
Access modifiers cannot be used for local variables.
Yes
No
Can be yes or no
Can not say
Which of the following can be operands of arithmetic operators?
Characters
Boolean
Numeric
Both Numeric & Characters
Modulus operator, %, can be applied to which of these?
Both Integers and floating-point numbers
Integers
Floating-point numbers
None of the mentioned
Decrement operator,--, decreases the value of variable by what number?
1
2
3
4
Which of these statements are incorrect?
A. B. As C. D.
Assignment operators can be used only with numeric and character data type
Assignment operators are more efficiently implemented by Java run-time system than their equivalent long forms
Assignment operators run faster than their equivalent long forms
None of the mentioned
Can 8 byte long data type be automatically type cast to 4 byte float data type?
TRUE
FALSE
Can be true or false
can not say
Evaluate the value of the expression?
6 - 2 + 10 % 4 + 7
14
12
13
10
What is/are highest order precedence operator(s) in Java?
()
{}
Both A & B
None of these
The && and || operators
Compare two boolean values
Compare two numeric values
Combine two boolean values
Combine two numeric values
Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
((x < 100) && (x > 1)) && (x < 0)
((x < 100) && (x > 1)) || (x < 0)
(1 > x > 100) || (x < 0)
1 < x < 100 || x < 0
Select from among the following character escape code which is not available in Java.
\\
\v
\a
\t
Which of the following will produce an answer that is closest in value to a double, d, while not being greater than d?
(int)Math.min(d);
(int)Math.abs(d);
(int)Math.max(d);
(int)Math.floor(d);
Predict the output of following Java Program?
Compiler Error: Operator >> cannot be applied to negative numbers
-2
2
2
2
2
With x = 0, which of the following are legal lines of Java code for changing the value of x to 1?
1. x++;
2. x = x + 1;
3. x += 1;
4. x =+ 1;
1, 2 & 3
1 & 4
1, 2, 3 & 4
3 & 2
_________ are a sequence of characters.
Character
Strings
Integer
Classes
In Java programming language, strings are treated as objects.
TRUE
FALSE
Can be true or false
Can not say
The String class is?
mutable
immutable
Both A and B
None of the above
Methods used to obtain information about an object are known as?
string methods
class methods
object method
accessor methods
Which method returns the character at the specified index?
int compareTo(Object o)
int compareTo(String anotherString)
char charAt(int index)
int compareToIgnoreCase(String str)
Which of these method of String class is used to obtain character at specified index?
char()
Charat()
charat()
charAt()
A __________ statement allows us to execute a statement or group of statements multiple times.
array
loop
function
exception
A __________ loop statement in Java programming language repeatedly executes a target statement as long as a given condition is true.
for
do-while
while
None of the above
