Table of Contents
Java Variable Declaration and Initialization: Best Practices
🔒 Please log in to unlock this course.
ONLINE CLASSES BY RUMMAN ANSARI
Stuck on a Java Program? Ask Your Doubt Directly
Book a one-to-one session to get your questions answered, or message on WhatsApp for live online classes in Java Programming.
- 1:1 Mentoring
- Doubt Clearing
- Interview Preparation
MCQ Section
MCQ 1
What will be the output after compiling and running following program code? public class Test{…
Locked. Enroll to open this MCQ.
MCQ 2
What will be the output after the following program is compiled and executed? public class Test{…
Locked. Enroll to open this MCQ.
MCQ 3
Determine output: class A{ { System.out.print("b1 "); } public A(){ System.out.print("b2 "); } }…
Locked. Enroll to open this MCQ.
MCQ 4
Determine Output: class MyClass{ static final int a = 20; static final void call(){…
Locked. Enroll to open this MCQ.
MCQ 5
What will be the output for the below code? static public class Test{ public static void…
Locked. Enroll to open this MCQ.
MCQ 6
What is the output for the below code ? public class A{ static{ System.out.println("static"); } {…
Locked. Enroll to open this MCQ.
MCQ 7
What will be the output? public class Test{ static{ int a = 5; } public static void main(String…
Locked. Enroll to open this MCQ.
MCQ 8
Determine output: public class InitDemo{ static int i = demo(); static{ System.out.print(i); }…
Locked. Enroll to open this MCQ.
MCQ 9
What will be the output for the below code? public class Test{ static{ int a = 5; } public static…
Locked. Enroll to open this MCQ.
MCQ 10
Consider the following two classes declared and defined in two different packages, what can be…
Locked. Enroll to open this MCQ.
MCQ 11
What is the result of compiling and running the following code? class Base{ private Base(){…
Locked. Enroll to open this MCQ.
MCQ 12
What is the result of compiling and running the following code? public class Tester{ static int x =…
Locked. Enroll to open this MCQ.
MCQ 13
Which statements are most accurate regarding the following classes? class A{ private int i;…
Locked. Enroll to open this MCQ.
MCQ 14
What will be the output? public class Test{ public static void main(String[] args){ String value =…
Locked. Enroll to open this MCQ.
MCQ 15
Choose the correct statement public class Circle{ private double radius; public Circle(double…
Locked. Enroll to open this MCQ.
MCQ 16
The object is created with new keyword
Locked. Enroll to open this MCQ.
MCQ 17
Choose all the lines which if inserted independently instead of "//insert code here" will allow the…
Locked. Enroll to open this MCQ.
MCQ 18
You have the following code in a file called Test.java class Base{ public static void main(String[]…
Locked. Enroll to open this MCQ.
MCQ 19
What can directly access and change the value of the variable qusNo? package com.mypackage; public…
Locked. Enroll to open this MCQ.
MCQ 20
Name the keyword that makes a variable belong to a class, rather than being defined for each…
Locked. Enroll to open this MCQ.
MCQ 21
What is the result of compiling and running the following code? public class Tester{ static int x =…
Locked. Enroll to open this MCQ.
MCQ 22
Suppose a class has public visibility. In this class we define a protected method. Which of the…
Locked. Enroll to open this MCQ.
MCQ 23
A package is a collection of
Locked. Enroll to open this MCQ.
MCQ 24
Choose the correct statement. Restriction on static methods are: I. They can only call other static…
Locked. Enroll to open this MCQ.
MCQ 25
A method within a class is only accessible by classes that are defined within the same package as…
Locked. Enroll to open this MCQ.
Get Java Programming Language updates by email
Short, practical lessons and course updates from Rumman Ansari. No spam.