Font size
WorksheetsJava Fundamental Test 01
Total questions: 96
Worksheet time: 2hrs 36mins
Java was developed by
James gosling
John gosling
James frank
John frank
The keyword "method" is another name for
an object
a class
a function
a variable
Which of the following is NOT a numeric data type
int
double
float
decimal
Which of the following is incorrect?
int count = 50.0;
int salary = 50_000;
int salary = 50_00;
all of these are incorrect
The numeric type int uses how many bits?
31
32
63
64
Which of the following is an example of a reference variable declaration?
int count;
String name;
float gpa;
char firstInitial;
Where does a java program start executing instructions from:
class
source file
main method
object
What is the main difference between float and double data types?
4.1 is an example of float.
4.11 is an example of double.
Float consists of 8 bytes, and double consists of 4 bytes.
Float consists of 4 bytes, and double consists of 8 bytes.
What kind of data type is used for numbers?
Integer
String
Boolean
Floating Point
Java Tokens help the compiler. Which of the following is a type of Java Token?
Identifiers
Keywords
Operators
All of the answers.
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the following should be the file name in Java
Object Name
Variable Nam
Class Name
Array Name
A ___________ file is created after successful compilation of a Java program.
Object file
Array file
Class file
String file
Command to compile Java program
javax
javay
javac
Java
Command to run a Java program
javaa
java
jaava
jaavaa
JDK stands for
Java Developer Kit
Java Development Kit
Java Design Kit
Java Debugging Kit
JRE stands for
Java Run Environment
Java Run Execution
Java Runtime Environment
Java Ready Execution
Java is
Machine dependent language
Machine independent language
In Java WORA stands for
Write Once Recall Anywhere
Write Once Return Anywhere
Write Once Read Anywhere
Write Once Run Anywhere
JVM stands for
Java Vital Machine
Java Virtual Machine
Java Vendor machine
Java programs ________________
are only compiled
are only compiled not interpreted
are only interpreted
are both compiled and interpreted
Main() method is not mandatory for a Java program
True
False
Which of the following personality is called as father of Java Programming language –
Guido vom Russom
Larry Page
Bjarne Stroustrup
James Gosling
Which component is used to compile, debug and execute java program?
JDK
JRE
JVM
JIT
The icon of Java program is taken from ___.
a cup of coffee
a tornado that spits fire
a volcano under water
a candle with a flame
What output will be produced by:
System.out.print("\\* This is not\n a comment *\\"):
* This is not a comment *
\* This is not a comment *\
* This is not
a comment *
\\* This is not
a comment *\\
\* This is not
a comment *\
What value is stored in result if:
int result = 13 - 3 * 6 / 4 % 3;
-5
0
13
-1
12
Suppose that addition and subtraction had higher precedence than multiplication and division. Then the expression:
2 + 3 * 12 / 7 - 4 + 8
would evaluate to which of the following?
11
12
5
9
-4
Name the data type: "true"
boolean
char
String
double
Name the data type: 1.0
double
int
char
boolean
Name the data type: '3'
int
char
String
None of the above
Name the data type: false
String
boolean
int
None of the above
What data type would you use for storing the number of students in a class?
boolean
String
double
int
What data type would you use for storing the average test score in a class?
double
String
int
char
What data type would you use for storing letter grades (without - or +) for students in a class?
String
char
int
boolean
What data type would you use to store names of students?
String
char
boolean
None of these
How would you declare a variable storing a person's name?
string name = "Jeff";
name String = "Jeff";
String name = Jeff;
String name = "Jeff";
How would you declare a variable storing the tax rate?
int taxRate = 5.1;
taxRate = "5.1";
double taxRate = 5.1;
double taxRate = "5.1";
Which expression evaluates to false?
15 % 3 < 2
3 * 3 % 2 <= 0
false == false
false == false == false == false
Which declaration will throw an error?
double num = 8;
int averageGrade = 89.7;
boolean done = false;
String done = "true";
What prints out "I love Java" successfully?
System.out.println(I love Java);
Systemoutprintln("I love Java);
System.out.println("I love" + " Java");
System.out.println("I love Java")
Consider the following code segment:
Line 1: int a = 10;
Line 2: double b = 10.7;
Line 3: double c = a + b;
Line 4: int d = a + c;
Line 5: System.out.println(c + " " + d);
What will be output as a result of executing the code segment?
20 20
20.0 30
20.7 31
20.7 30.7
Nothing will be printed because of a compile-time error.
Consider the following code segment:
Line 1: int a = 11;
Line 2: int b = 4;
Line 3: double x = 11;
Line 4: double y = 4;
Line 5: System.out.print(a / b);
Line 6: System.out.print(", ");
Line 7: System.out.print(x / y);
Line 8: System.out.print(", ");
Line 9: System.out.print(a / y);
What is printed as a result of executing the code segment?
3, 2.75, 3
3, 2.75, 2.75
2, 3, 2
2, 2,75, 2.75
Nothing will be printed because of a compile-time error.
Consider the following code segment:
int var = 12;
var = var % 7;
var = var - 1;
System.out.println(var);
What is printed as a result of executing the code segment?
0
1
2
4
5
Consider the following code segment:
int count = 5;
double multiplier = 2.5;
int answer = (int)(count * multiplier);
answer = (answer * count) % 10;
System.out.println(answer);
What is printed as a result of executing the code segment?
0
2.5
6
12.5
60
Which is a valid keyword in java?
interface
string
Float
unsigned
What type of literal is "null"?
null Literal
Character Literal
String Literal
It is not a Literal
Function of the Scanner class to accept a float literal from the user is
nextInt( )
hasNext( )
next( )
nextFloat( )
What is the value of c after int c = 'B'+3; is executed?
101
69
Code is incorrect
B3
What is the value of c after int c = 'B'+3; is executed?
101
69
Code is incorrect
B3
What is the value of p after the following statement is executed?
int p=4538%100
8
38
4538
4
Which of the following terms mean "will not return any value"?
public
static
void
main()
Which component is responsible to optimize bytecode to machine code?
JRE
JVM
JDK
JIT
Which statement is true about java?
Sequence dependent programming language
Code dependent programming language
Platform independent programming language
Platform dependent programming language
JVM is _____
code dependent
code independent
platform dependent
platform independent
What is the extension of compiled java classes?
.class
.js
.txt
.java
Which of the following option leads to the portability and security of Java?
The applet makes the Java code secure and portable
Use of exception handling
Dynamic binding between objects
Bytecode is executed by JVM
In which memory a String is stored, when we create a string using new operator?
Stack
String memory
Random storage space
Heap memory
correct execution process in Java
load->edit->compile->verify->execute
edit->load->compile->execute->verify
edit->compile->load->verify->execute
verify->edit->compile->load->execute
Which of the following are Java features?
Object- oriented programming
Class- based programming
Bytecode is platform independent
All of above
Which of the following are Java features?
Object- oriented programming
Class- based programming
Bytecode is platform independent
All of above
What does IDE mean?
Integration Development Environment
Integration Device Environment
Which one is correct?
public static main(Strings[] args) { }
public private static main(Strings[] args) { }
public static void main(Strings[] args) { }
public void static main(Strings[] args) { }
char is 2 byte in storage?
True
False
(=) sign means
equals and it is used for math problems in Java
assignment operator. It used to assign a value
Which one is used for remainder in Java?
/
%
+
*
Which of the below is/are valid identifier with the main method?
public
private
static
this
What is the extension of java code files?
.class
.txt
.java
.js
Compilation statement in java
java filename
javac filename
java filename.java
javac filename.java
Which statement is used to run the java program?
javac filenemae.java
java filename
javac filename
java filename.java
java compiler converts the java file into _________ file.
.jvm
.class
.obj
.java
.class file of any java program can run on any machine. Is it true or false
true
false
public static void main(String args[]). In this statement what is args[]?
name of a variable
Array variable which is of string type
variable
string variable
Which of the following is true?
public static void main(String args[])
public static void main(String a[])
public static void main(String arg[])
All the above
Reason for declaring main() as static.
to use static variable
to use static methods inside main()
Need not to create obj for accessing members of main()
None of the above
When command line arguments are passed to the main()?
While declaring method
During Compile time of the program
During Runtime of the program
When calling main()
Which is NOT a property of Java
Object-Oriented
Dynamically Typed
Distributed and Multi-Threaded
Architechturally Neutral
The program Eclipse is an example of what?
Debugger
Text Editor
Compiler
Integrated Development Environment (IDE)
All Java programs must be contained inside of which programming structure?
class
comment
function
bytecode
Which instruction can be used to print "Hi" to the screen?
System.out.printline("Hi");
System.out.println("Hi");
System.out.println("Hi")
System.println("Hi");
What file extension do all Java source code files need to have?
.class
.txt
.py
.java
________ operator is used to check the equality of two values
>=
=
*=
==
JVM is a _____________
Hardware
Software
