NEW
Font size
WorksheetsJava Basics
Total questions: 35
Worksheet time: 18mins
Java is a
Procedure Oriented Language
Structure Oriented Language
Object_Oriented Language
Machine Language
The name of the main template used in Java should be the
Object Name
Class Name
Variable Name
Array Name
Java program is
Interpreted
Compiled
Java program does not run without the following method
main()
system()
void()
user()
A ___ file is created after compilation of a Java program.
Class file
Object file
Array file
String file
Java is a
Machine language
Higher-level language
The keyword "method" is another name for
a variable
a class
a function
an object
Which of the following is NOT a numeric data type
int
float
double
decimal
Which of the following is incorrect ?
int count = 50.0;
int salary = 50_00;
int salary = 50_000;
all of these are incorrect
The numeric type FLOAT uses how many bits?
31
32
63
64
Which of the following is an example of a text reference variable declaration?
int count;
float gpa;
String name;
char firstInitial;
Where does a java program start executing instructions from:
class
main method
source file
object
Which of the following terms mean "will not return any value"?
public
static
void
main()
When we want to print in Java, we use the code ......
system.out.print();
System.Out.Printf();
System.out.println();
System.out.show();
A variable that holds a whole number
String
int
boolean
float
A variable that holds words
String
int
boolean
float
A variable that holds a decimal number
String
int
boolean
float
A variable that holds a character
String
int
boolean
char
What is at the end of a line of code?
#
;
)
>
These controls the behavior of a program.
class
object
method
void
What does a comment look like in Java?
//comment
\\comment
\comment
==comment
A variable that holds true or false
String
int
boolean
float
How would you declare a variable storing the sales tax rate (like 7%)?
int taxRate = 5.1;
String taxRate = "5.1";
double taxRate = 5.1;
I do hereby declare thee Sir Tax Rate
Which declaration will throw an error?
double num = 8;
int averageGrade = 89.7;
boolean done = false;
String done = "true";
Mrs Coile throwing a baseball
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")
What is love? Baby dont hurt me. Dont hurtme. No more.
int sum1 = 100 + 50;
int sum2 = sum1 + 250;
int sum3 =sum2 + sum2;
System.out.println(sum3);
What will be the
950
800
sum2sum2
sum1250
Which of the following is assignment operator?
==
++
+
=
int x = 10;
x = x + 5;
System.out.println(x);
What will be the output?
5
15
x5
55
x /= 3
Which of the below statements matches with above statement?
x = 3 / x
x / 3
x = x / 3
x /x = 3
What is the output of below code?
int x = 4.4;
int y = 5.5;
System.out.println(x == y);
4.4
5.5
9.9
Error
Which of the following terms means the main method is accessible everywhere within the class?
public
static
void
main
You are writing a Java program that needs to manipulate very large integer values that may exceed 12 digits. The values can be positive or negative. Which data type should you use to store a variable like this?
int
float
double
boolean
You are developing an algorithm for a retail Web site. You need to calculate discounts on certain items based on the quantity purchased. You develop the following decision table to calculate the discount. If a customer buys 50 units of an item, what discount will be applicable to the purchase?
5 percent
10 percent
15 percent
20 percent
You are developing an algorithm before you write the C# program. You need to perform some calculations on a number. You develop the following flowchart for the calculation:
If the input value of n is 5, what is the output value of the variable fact according to this flowchart?
720
120
24
6
You need to gain a better understanding of the solution before writing the program. You decide to develop an algorithm that lists all necessary steps to perform an operation in the correct order. Any technique that you use should minimize complexity and ambiguity. Which of the following techniques should you use?
flowchart
decision table
Java program
A paragraph in English
