20 questions
Wrapping up of data and functions into a single unit called class is known as_____.
Abstraction
Inheritance
Polymorphism
Encapsulation
interface is a ______ datatype.
Primitive
Composite
Java expression for (under root of 2as+u2) is:
Math.sqrt ( 2 * a * s + Math.pow ( u, 2 ) )
Math.cbrt(2 x a x s) + u x 2
Root over of 2 *a*S + u*u
Math.sqrt ( 2 * a * s + Math.pow ( u, 2 ) );
Multiplication operator used when the operation should be division.
What kind of error is this?
Syntax error
Typo
Logical error
Run-time error
int arr[] = new int[10];
This statement declares an _____ array of _____elements.
double, 10
int, 10
integer, 10
point value, 10
What is the output?
int a = 63, b = 36;
boolean x = (a < b ) ? true : false; int y= (a > b ) ? a : b ;
x= true , y=65
x= true y= 63
x= false y= 64
x= false y=63
What will be the result stored in x after evaluating the following expression?
int x=4;
x += (x++) + (++x) + x;
20
21
22
15
State the method that:
Converts a string to a primitive float data type
float.parsefloat()String;
Float.parseFloat(String)
Float.Parsefloat(String);
Float.parseFloat(String);
What will the following code output?
String s = "malayalam";
System.out.println(s.indexOf('m'));
System.out.println(s.lastIndexOf('m'));
0
8
0 8
1 7
1
7
A _______ is a constant data item.
Number
Character literal
Literal
None of the above
int x =12; long y = x;
What kind of type casting is this?
Explicit
Implicit
A class is a _____ an object.
creator
planner
blueprint
prototype
Which element is represented by a[10]?
9th
10th
11th
1st
Arrays are_____.
Objects
Object References
Primitive datatype
Identifiers
An array element can be accessed through:
Dot
Name of the array
Index Number
All of the above
int m[] = {2,4,6,8};
System.out.println(m[1] + " " + m[2]);
What is the output
26
2 6
2
6
none of the above
The ______ function is executed first in a java program.
first one in the order
static functions
main()
char x = 'A' ; int m;
m=(x=='a') ? 'A' : ‘a’;
System.out.println("m="+m);
Give the output:
9 7
97
9 6
96
What is the most appropriate definition of an object?
Object is a blueprint of a class.
Object is the prototype of a class.
Object is an instance of a class.
Object is the copy of a class
Which one of these is incorrect?
String objects are immutable.
String objects are actually arrays of charcters.
String is a primitive datatype.