Java
Test
Model Test
Ebook
Quiz 1: Java Programming
Index
Java Home
Basics
31
Methods
11
I/O
3
Appendix
2
Control Structure
4
Class and Object
11
OOP Concepts
18
Exception Handling
10
Threading
15
Operators
15
Collection
12
Schools
Ebook
Question:
To
run
a java file from command prompt we write-
A
java class_name
B
javac class_name
C
class_name
D
javac
Note:
Not available
Show answer
Show Note
Report
Question:
Which of the following values can you assign to a variable of type int?
A
10.55
B
'S'
C
True
D
0
Note:
Not available
Show answer
Show Note
Report
Question:
Which of the following data types can store a value in the least amount of memory?
A
short
B
long
C
int
D
byte
Note:
Not available
Show answer
Show Note
Report
Question:
A Boolean value can hold the values
true
and
false
.
A
True
B
False
Note:
Not available
Show answer
Show Note
Report
Question:
What will be the output of the following java program?
class Adds{
public static void main(String args[]){
int x = 20;
int y = 10;
int z = x + y;
System.out.println(" The addition of " + x + " and " + y + " is " + z);
}
}
A
20
B
10
C
30
D
40
Note:
Not available
Show answer
Show Note
Report
Question:
Which one is the correct structure for declaring a method within a class?
A
class Hello{
public static void amin(String args[]){
System.out.println("Hello World !!");
}
}
B
class Hello{
System.out.println("Hello World !!")
}
C
class Hello{
public static void amin{String args[]}(
System.out.println("Hello World !!");
)
}
D
class Hello{
}
Note:
Not available
Show answer
Show Note
Report
Question:
A method must include the following -
A
A diclaration
B
An opening curly brace
C
A leg
D
A body
E
A closing curly brace
Note:
Not available
Show answer
Show Note
Report
Question:
Methods must include all of the following except -
A
a declaration
B
a call to another method
C
curly braces
D
a body
Note:
Not available
Show answer
Show Note
Report
Question:
All method declaration must contain -
A
the keyword "static"
B
one or more aceess modifiers
C
arguments
D
parantheses
Note:
Not available
Show answer
Show Note
Report
Question:
Which of the method declarations is correct for a method named displayFacts() if the method receives an int argument?
A
public void int displayFacts()
B
public void displayFacts(int)
C
public void displayFacts(int data)
D
public void displayFacts()
Note:
Not available
Show answer
Show Note
Report
First
Prev
1
2
3
4
Next
Last
/14
Go
Schools
App Store
Whiteboard
Blogs
Quiz
Test
Apply Course
Games
Freelancers
Professionals
Newspapers
Terms
Privacy
Copyright © 2025. Powered by
Intellect Software Ltd