2.What should be the execution order, if a class has a method, static block, instance block, and constructor, as shown below?

public class First_C {
public void myMethod() {
System.out.println("Method");
}
{
System.out.println(" Instance Block");
}
public void First_C() {
System.out.println("Constructor ");
}
static {
System.out.println("static block");
}
public static void main(String[] args) {
First_C c = new First_C();
c.First_C();
c.myMethod();
}
}

3.Evaluate the following Java expression,
if x=3, y=5, and z=10:
++z + y - y + z + x++
7.Given that Student is a class, how many reference variables and objects are created by the following code?

Student studentName, studentId;
studentName = new Student();
Student stud_class = new Student();

12.How many times 'Hello' is printed?

public class CppBuzz {
public static void main(String[] args){
for(int i = 0; i<5; i=5 ){
System.out.println("Hello");
}
}
}

13.What is the stored in the object obj in following lines of Java code?

Box obj;

15.What will be the output of the following Java program?

class main_class
{
public static void main(String args[])
{
int x = 9;
if (x == 9)
{
int x = 8;
System.out.println(x);
}
}
}

21.Write program to Move all zeroes to end of the given array


1. Input : arr[] = {1, 2, 0, 4, 3, 0, 5, 0};
2. Output : arr[] = {1, 2, 4, 3, 5, 0, 0, 0};