You are on page 1of 2

Quiz Question Set – 1

(LBJ Module 3– Java Basics)


Q.1) Which method is called to begin the execution of a Java program?

Q.2) What does a Java program gets compiled into?

Q.3) What is it that we need to run a Java program on any platform/operating system?

Q.4) What do we use for storing more than one value of the same type in the memory?

Q.5) Which datatype has the limit of range between -32,768 to +32,767?

Q.6) Write a Java program which will swap the values of two variables without using a third
temporary variable

Q.7) Write a Java program which will display whether a given number is prime number or
not. For ex, in case of int x = 13, the program should display “13 is a prime number”.
Similarly in case of int x = 12, the program should display “12 is not a prime number”

Q.8) Write a Java program which will calculate EMI based on the following inputs:
public class Bank {
public static void main(String[] args) {
int loanAmount = 500000;
int tenureInYears = 5;
double interestRate = 10.10;

//write code here in your IDE to calculate the EMI and display the same…

}
}

Q.9) What will be the output of below Java program:


public class A {
public static void main(String[] args) {
if (true)
break;
System.out.println("Hello");
}
}

Q.10) What will be the output of below Java program:


public class Demo{
public static void main(String[] arr){
int num1 = 100;
int num2 = 100;
int num3 = 500;
int num4 = 500;

if(num1==num2){
System.out.println("num1 == num2");
}
else{
System.out.println("num1 != num2");
}
if(num3 == num4){
System.out.println("num3 == num4");
}
else{
System.out.println("num3 != num4");
}
}
}

You might also like