Table of Contents
Java Interview Questions
🔒 Please log in to unlock this course.
If you require additional resources, consider purchasing: ICSE Computer Applications Class 10 – Previous Year Question Papers & Solutions (Java Fundamentals)
Related Questions
Question 1
What is an exception?
Locked. Enroll to open this question.
Question 2
Rewrite the following program segment using while instead of for statement. int f = 1, i; for(i =…
Locked. Enroll to open this question.
Question 3
What will the following code output: String s = "malayalam"; System.out.println(s.indexOf('m'));…
Locked. Enroll to open this question.
Question 4
State the data type and values of a and b after the following segment is executed: String s1 =…
Locked. Enroll to open this question.
Question 5
State the method that: Converts a string to a primitive float data type. Determines if the…
Locked. Enroll to open this question.
Question 6
State the output of the following program segment: String s = "Examination"; int n = s.length();…
Locked. Enroll to open this question.
Question 7
Give output of the following program segment: double x = 2.9, y = 2.5;…
Locked. Enroll to open this question.
Question 8
What will be the result stored in x after evaluating the following expression? int x = 4; x +=…
Locked. Enroll to open this question.
Question 9
State the values of n and ch. char c = 'A'; int n = c + 1; char ch = (char)n;
Locked. Enroll to open this question.
Question 10
What are the values of x and y when the following statements are executed? int a = 63, b = 36;…
Locked. Enroll to open this question.
Question 11
In the program given below, state the name and the value of the: method argument or argument…
Locked. Enroll to open this question.
Question 12
Example of Array Declaration and Initialization
Locked. Enroll to open this question.
Question 13
Name the Java keyword that: indicates that a method has no return type. stores the address of the…
Locked. Enroll to open this question.
Question 14
Write statements to show how finding the length of a character array char[] differs from finding…
Locked. Enroll to open this question.
Question 15
What is the difference between a break statement and a continue statement when they occur in a loop?
Locked. Enroll to open this question.
Question 16
Name any two wrapper classes.
Locked. Enroll to open this question.
Question 17
What are the types of casting shown by the following examples? double x = 15.2;int y = (int) x; int…
Locked. Enroll to open this question.
Question 18
Give a difference between a constructor and a method.
Locked. Enroll to open this question.
Question 19
State the Java concept that is implemented through: a superclass and a subclass. the act of…
Locked. Enroll to open this question.
Question 20
What is a literal?
Locked. Enroll to open this question.
Question 21
What is meant by precedence of operators?
Locked. Enroll to open this question.
Question 22
Differentiate between public and private modifiers for members of a class.
Locked. Enroll to open this question.
Question 23
Name the search or sort algorithm that: Makes several passes through the array, selecting the next…
Locked. Enroll to open this question.
Question 24
What is an array? Write a statement to declare an integer array of 10 elements.
Locked. Enroll to open this question.
Question 25
Write a statement each to perform the following tasks on a string: (i) Find and display the…
Locked. Enroll to open this question.
Question 26
Write an expression in Java for:z = (5x^3 + 2y)/(x + y)
Locked. Enroll to open this question.
Question 27
Give the prototype of a function search which receives a sentence sentnc and a word wrd and returns…
Locked. Enroll to open this question.
Question 28
Explain the concept of constructor overloading with an example.
Locked. Enroll to open this question.
Question 29
What will be the output of the following code? (i) int k = 5, j = 9; k += k - j + k;…
Locked. Enroll to open this question.
Question 30
Analyse the following program segment and determine how many times the loop will be executed and…
Locked. Enroll to open this question.
Question 31
What is the role of the keyword void in declaring functions?
Locked. Enroll to open this question.
Question 32
Write the output of the following:(i) System.out.println(Character.isUpperCase('R'));(ii)…
Locked. Enroll to open this question.
Question 33
Give the output of the following: String n = "Computer Knowledge."; String m = "Computer…
Locked. Enroll to open this question.
Question 34
Name the keyword that: (i) Informs that an error has occurred in an input/output operation.(ii)…
Locked. Enroll to open this question.
Question 35
What are library classes? Give an example.
Locked. Enroll to open this question.
Question 36
Complete the code below to create an object of Scanner class: Scanner sc = ____ Scanner(__________);
Locked. Enroll to open this question.
Question 37
Define Trademarks.
Locked. Enroll to open this question.
Question 38
Create a class with one integer instance variable. Initialize the variable using: default…
Locked. Enroll to open this question.
Question 39
Name the type of error (syntax, runtime or logical error) in each case given below: Division by a…
Locked. Enroll to open this question.
Question 40
Write a Java expression for √(2as + u²).
Locked. Enroll to open this question.
Question 41
Differentiate between call by value or pass by value and call by reference or pass by reference.…
Locked. Enroll to open this question.
Question 42
Give one point of difference between unary and binary operators.
Locked. Enroll to open this question.
Question 43
Give one example each of a primitive data type and a composite data type.
Locked. Enroll to open this question.
Question 44
Write one difference between Linear Search and Binary Search. Java Language
Locked. Enroll to open this question.
Question 45
(i) Name the package that contains the Scanner class.(ii) Which unit of the class gets called when…
Locked. Enroll to open this question.
Question 46
Write a Java statement to create an object mp4 of class Digital.
Locked. Enroll to open this question.
Question 47
Name the keyword which is used- to resolve the conflict between method parameter and instance…
Locked. Enroll to open this question.
Question 48
Name the wrapper classes of char type and boolean type.
Locked. Enroll to open this question.
Question 49
Identify the literals listed below: (i) 0.5 (ii) 'A' (iii) false (iv) "a"
Locked. Enroll to open this question.
Question 50
What are identifiers ?
Locked. Enroll to open this question.
Question 51
Name any two OOP’s principles.
Locked. Enroll to open this question.
Question 52
What are the default values of the primitive data type int and float?
Locked. Enroll to open this question.
Question 53
What will be the output when the following code segments are executed? (i) String s = "1001"; int x…
Locked. Enroll to open this question.
Question 54
Consider the following class: public class myClass { public static int x=3, y=4; public int a=2,…
Locked. Enroll to open this question.
Question 55
Study the method and answer the given questions. public void sampleMethod() { for (int i=0; i < 3;…
Locked. Enroll to open this question.
Question 56
State the value of characteristic and mantissa when the following code is executed: String s =…
Locked. Enroll to open this question.
Question 57
Evaluate the value of n if value of p = 5, q = 19 int n = (q – p) > (p – q) ? (q – p) : (p – q);
Locked. Enroll to open this question.
Question 58
Arrange the following primitive data types in an ascending order of their size: (i) char (ii) byte…
Locked. Enroll to open this question.
Question 59
(i) What will this code print ? int arr[]=new int[5]; System.out.println(arr); 0 value stored in…
Locked. Enroll to open this question.
Question 60
(i) Name the mathematical function which is used to find sine of an angle given in radians.(ii)…
Locked. Enroll to open this question.
Question 61
The access specifier that gives the most accessibility is ________ and the least accessibility is…
Locked. Enroll to open this question.
Question 62
State the output when the following program segment is executed: String a ="Smartphone", b="Graphic…
Locked. Enroll to open this question.
Question 63
What is the function of catch block in exception handling ? Where does it appear in a program ?
Locked. Enroll to open this question.
Question 64
State the data type and value of y after the following is executed: char x='7';…
Locked. Enroll to open this question.
Question 65
What are the values of a and b after the following function is executed, if the values passed are…
Locked. Enroll to open this question.
Question 66
Name the two types of constructors
Locked. Enroll to open this question.
Question 67
What is the value stored in variable res given below: double res = Math.pow ("345".indexOf('5'), 3);
Locked. Enroll to open this question.
Question 68
What is the data type returned by the library functions : compareTo() equals()
Locked. Enroll to open this question.
Question 69
Give the output of the following method: public static void main (String [] args){ int a = 5; a++;…
Locked. Enroll to open this question.
Question 70
Rewrite the following program segment using if-else statements instead of the ternary operator:…
Locked. Enroll to open this question.
Question 71
Which of the following are valid comments ? /*comment*/ /*comment //comment */comment*/
Locked. Enroll to open this question.
Question 72
Name the method of Scanner class that: is used to input an integer data from the standard input…
Locked. Enroll to open this question.
Question 73
What is the final value of ctr when the iteration process given below, executes? int ctr = 0;…
Locked. Enroll to open this question.
Question 74
If int n[] = {1, 2, 3, 5, 7, 9, 13, 16}, what are the values of x and y? x = Math.pow(n[4], n[2]);y…
Locked. Enroll to open this question.
Question 75
Write a Java expression for: \[ \begin{align} \\ & u t + \frac{1}{2} f t^2 \end{align} \]
Locked. Enroll to open this question.
Question 76
What is the data type that the following library functions return? isWhitespace(char ch)…
Locked. Enroll to open this question.
Question 77
How many times will the following loop execute? What value will be returned? int x = 2, y = 50; do{…
Locked. Enroll to open this question.
Question 78
Rewrite the following program segment using the if..else statement: comm = (sale > 15000)? sale * 5…
Locked. Enroll to open this question.
Question 79
What does a class encapsulate?
Locked. Enroll to open this question.
Question 80
What is meant by a package ? Name any two java Application Programming Interface packages.
Locked. Enroll to open this question.
Question 81
Name the primitive data type in Java that is: a 64-bit integer and is used when you need a range of…
Locked. Enroll to open this question.
Question 82
State the output of the following program segment: String str1 = "great"; String str2 = "minds";…
Locked. Enroll to open this question.
Question 83
List the variables from those given below that are composite data types: static int x; arr[i]=10;…
Locked. Enroll to open this question.
Question 84
hat is constructor? When is it invoked?
Locked. Enroll to open this question.
Question 85
What is an infinite loop? Write an infinite loop statement.
Locked. Enroll to open this question.
Question 86
Give two differences between the switch statement and the if-else statement
Locked. Enroll to open this question.
Question 87
Identify the statements listed below as assignment, increment, method invocation or object creation…
Locked. Enroll to open this question.
Question 88
Operators with higher precedence are evaluated before operators with relatively lower precedence.…
Locked. Enroll to open this question.
Question 89
Find the errors in the given program segment and re-write the statements correctly to assign values…
Locked. Enroll to open this question.
Question 90
State one difference between the floating point literals float and double.
Locked. Enroll to open this question.
Question 91
State the values stored in the variables str1 and str2: String s1 = "good"; String s2 = "world…
Locked. Enroll to open this question.
Question 92
The characteristics of the ___________ objects are considered to be the data members of the…
Locked. Enroll to open this question.
Question 93
Define the following with an example each. (a) Inheritance (b) Polymorphism
Locked. Enroll to open this question.
Question 94
What is meant by Encapsulation?
Locked. Enroll to open this question.
Question 95
Mention two limitations of procedure oriented programming approach.
Locked. Enroll to open this question.
Question 96
What is meant by a base class and a derived class?
Locked. Enroll to open this question.
Question 97
Why do we prefer object oriented approach in complex programming? Explain.
Locked. Enroll to open this question.
Question 98
Name four basic principles of object oriented programming.
Locked. Enroll to open this question.
Question 99
What is object oriented programming? Name two object oriented programming languages.
Locked. Enroll to open this question.
Question 100
In encapsulation, data can be ___________ or ___________ whereas, in data hiding, data must be…
Locked. Enroll to open this question.
Question 101
___________ confirms the security of data members from being manipulated from unauthorized access.
Locked. Enroll to open this question.
Question 102
In what way is Data Hiding related to Data Abstraction?
Locked. Enroll to open this question.
Question 103
Give an example to explain Data Abstraction.
Locked. Enroll to open this question.
Question 104
The ___________ of a class differs on various characteristics.
Locked. Enroll to open this question.
Question 105
A real world object deals with characteristics and ___________ .
Locked. Enroll to open this question.
Question 106
A class is also considered as an ___________ factory.
Locked. Enroll to open this question.
Question 107
Creating ___________ is the fundamental concept in object oriented programming language.
Locked. Enroll to open this question.
Question 108
Which of the Object Oriented programming principles explain the following illustrations? Justify.
Locked. Enroll to open this question.
Question 109
Give two differences between Procedure Oriented languages and Object Oriented languages.
Locked. Enroll to open this question.
Question 110
'Encapsulation reduces the complexity and makes the system easier'. Explain this statement with a…
Locked. Enroll to open this question.
Question 111
Give two differences between Data Hiding and Encapsulation.
Locked. Enroll to open this question.
Question 112
What is meant by Data Hiding?
Locked. Enroll to open this question.
Question 113
___________ promotes the reusability feature, in object oriented programming.
Locked. Enroll to open this question.
Question 114
Feature of wrapping ___________ and ___________ as a single unit is called encapsulation.
Locked. Enroll to open this question.
Question 115
___________ is an act of representing essential features without including background details.
Locked. Enroll to open this question.
Question 116
Write the difference between POP and OOP.
Locked. Enroll to open this question.
Question 117
Write the difference between High Level Language and Low-Level language?
Locked. Enroll to open this question.
Question 118
Write the difference between High Level Language and Low-Level language.
Locked. Enroll to open this question.
Question 119
Write two Advantages of High-level language?
Locked. Enroll to open this question.
Question 120
Write any two advantages of Procedural Oriented language
Locked. Enroll to open this question.
Question 121
What do you mean by Computer language? Name any two computer languages.
Locked. Enroll to open this question.
Question 122
What is routines?
Locked. Enroll to open this question.
Question 123
What is procedures ?
Locked. Enroll to open this question.
Question 124
What is procedures ?
Locked. Enroll to open this question.
Question 125
Define Polymorphism with a real-life example.
Locked. Enroll to open this question.
Question 126
Write any 2 disadvantages of Object-oriented programming.
Locked. Enroll to open this question.
Question 127
Using a function for multiple operations is called as ___________ .
Locked. Enroll to open this question.
Question 128
Objects can communicate with each other through ___________ in object oriented programming language.
Locked. Enroll to open this question.
Question 129
___________ is the fundamental concept in object oriented programming language.
Locked. Enroll to open this question.
Question 130
What is difference between float and double in Java?
Locked. Enroll to open this question.
Question 131
Write down any two disadvantages of Machine Level Language
Locked. Enroll to open this question.
Question 132
Write down two advantages of Polymorphism.
Locked. Enroll to open this question.
Question 133
Write the difference between Assembly language and Machine level.
Locked. Enroll to open this question.
Question 134
Write the difference between Polymorphism and Encapsulation.
Locked. Enroll to open this question.
Question 135
Write the difference between Polymorphism and Encapsulation.
Locked. Enroll to open this question.
Question 136
What is the default value of byte datatype in Java?
Locked. Enroll to open this question.
Question 137
An object of a class is created by using a keyword ___________ .
Locked. Enroll to open this question.
Question 138
State the total size in bytes, of the arrays a[4] of char data type and p[4] of float data type.
Locked. Enroll to open this question.
Question 139
Analyze the following program segment and determine how many times the loop will be executed and…
Locked. Enroll to open this question.
Question 140
What will be the output of the following code? char x = 'A'; int m; m = (x == 'a') ? 'A' : 'a';…
Locked. Enroll to open this question.
Question 141
What will be the output of the following code? int m = 2; int n = 15; for(int i = 1; i < 5; i++) {…
Locked. Enroll to open this question.
Question 142
What do you understand by the term data abstraction? Explain with an example.
Locked. Enroll to open this question.
Question 143
Differentiate between private and protected visibility modifiers.
Locked. Enroll to open this question.
Question 144
Write the difference between length and length() functions.
Locked. Enroll to open this question.
Question 145
Differentiate between static and non-static data members.
Locked. Enroll to open this question.
Question 146
What is the result stored in x, after evaluating the following expression?Given: int x = 5;…
Locked. Enroll to open this question.
Question 147
State the purpose and return data type of the following String functions:
Locked. Enroll to open this question.
Question 148
Give the prototype of a function check which receives a character (ch) and an integer (n) and…
Locked. Enroll to open this question.
Question 149
State two features of a constructor.
Locked. Enroll to open this question.
Question 150
What is the difference between / and % operator?
Locked. Enroll to open this question.
Question 151
What are the two ways of invoking functions?
Locked. Enroll to open this question.
Question 152
State the difference between entry controlled loop and exit controlled loop.
Locked. Enroll to open this question.
Question 153
What does the token 'keyword' refer to, in the context of Java? Give an example for keyword.
Locked. Enroll to open this question.
Question 154
Difference between an object and a class?
Locked. Enroll to open this question.
Question 155
(ii) What is the use of the keyword import?
Locked. Enroll to open this question.
Question 156
Why is an object called an instance of a class?
Locked. Enroll to open this question.
Question 157
What will the following functions return when executed?
Locked. Enroll to open this question.
Question 158
Write a statement each to perform the following tasks on a string:
Locked. Enroll to open this question.
Question 159
Write two advantages of using functions in a program.
Locked. Enroll to open this question.
Question 160
What is an Exception? Name two Exception handling blocks.
Locked. Enroll to open this question.
Question 161
Name two jump statements and their use.
Locked. Enroll to open this question.
Question 162
What are the guiding principles of Data Protection Act?
Locked. Enroll to open this question.
Question 163
Write some facilities of Internet.
Locked. Enroll to open this question.
Question 164
What are the three types of Intellectual Rights?
Locked. Enroll to open this question.
Question 165
Give two examples of Intellectual Property.
Locked. Enroll to open this question.
Question 166
What does the word Ethics mean?
Locked. Enroll to open this question.
Question 167
A class is also referred to as 'Object Factory'. Comment.
Locked. Enroll to open this question.
Question 168
What does the following statement mean? Employee staff = new Employee ( );
Locked. Enroll to open this question.
Question 169
Define class and object with an example.
Locked. Enroll to open this question.
Question 170
How will you define a software object?
Locked. Enroll to open this question.
Question 171
Write two disadvantages of electronic mail.
Locked. Enroll to open this question.
Question 172
Why a good Anti-spam and Anti-Virus software needed?
Locked. Enroll to open this question.
Question 173
What do you mean by type conversion? How is implicit conversion different from explicit conversion?
Locked. Enroll to open this question.
Question 174
Define the term Byte code.
Locked. Enroll to open this question.
Question 175
What is Malicious Code? Name the different types of Malicious Codes.
Locked. Enroll to open this question.
Question 176
Write some reasons behind Hacking.
Locked. Enroll to open this question.
Question 177
What is hacking?
Locked. Enroll to open this question.
Question 178
What is Cybercrime?
Locked. Enroll to open this question.
Question 179
What are the different types of Piracy of software?
Locked. Enroll to open this question.
Question 180
What is BSA?
Locked. Enroll to open this question.
Question 181
What are the two types of software? Define them.
Locked. Enroll to open this question.
Question 182
___________ keyword is used for dynamic allocation of an object.
Locked. Enroll to open this question.
Question 183
Question 2
Locked. Enroll to open this question.
Question 184
Convert the following segment into an equivalent do- while loop. int a, b; for (a = 10, b = 20; b…
Locked. Enroll to open this question.
Question 185
What will be the output of the following program segment? int ar[] = {1, 2, 3, 4, 5}; int a = 1;…
Locked. Enroll to open this question.
Question 186
What will be the output of the following program segment? int a[] = {1, 2, 3, 4, 5, 6, 7, 9, 13,…
Locked. Enroll to open this question.
Question 187
i) Ramesh is trying to write a program to check whether a number is palindrome or not. Due to…
Locked. Enroll to open this question.
Question 188
চলন কাকে বলে
Locked. Enroll to open this question.
Question 189
প্রকরণ চলন কাকে বলে
Locked. Enroll to open this question.
Question 190
বক্র চলন কাকে বলে
Locked. Enroll to open this question.
Question 191
চলন গতি কাকে বলে
Locked. Enroll to open this question.
Question 192
চলন গতি কয় প্রকার
Locked. Enroll to open this question.
Question 193
উদ্ভিদের চলন কত প্রকার ও কি কি
Locked. Enroll to open this question.
Question 194
Write a difference between the functions isUpperCase( ) and toUpperCase( ).
Locked. Enroll to open this question.
Question 195
আবিষ্ট বা ট্যাকটিক চলন কাকে বলে, ট্যাকটিক চলন কাকে বলে
Locked. Enroll to open this question.
Question 196
ট্যাকটিক চলন কয় প্রকার
Locked. Enroll to open this question.
Question 197
ফটোট্যাকটিক চলন (Phototactic Movement)
Locked. Enroll to open this question.
Question 198
Differentiate between the following code fragments and also give their output :- int f = 1, i = 2;…
Locked. Enroll to open this question.
Question 199
Write the output of the following code :- String x; String str = "INFORMATION"; x =…
Locked. Enroll to open this question.
Question 200
c) If a=24, b=15. find the value of a+=b++ * 5/a++ +b
Locked. Enroll to open this question.
Question 201
Question 3
Locked. Enroll to open this question.
Question 202
(h) Evaluate the following expression if the value of x=2, y=3 and z=1. v=x + --z + y++…
Locked. Enroll to open this question.
Question 203
Declare a 2D array of integers in Java with 3 rows and 4 columns. Initialize the array with the…
Locked. Enroll to open this question.
Question 204
What is a composite datatype? What is a user-defined datatype?
Locked. Enroll to open this question.
Question 205
Given the following 2D array: int[][] matrix = { {5, 8, 3}, {4, 9, 7}, {6, 2, 1} }; Write a program…
Locked. Enroll to open this question.
Question 206
Write a Java program to calculate and print the sum of all elements in the following 2D array:…
Locked. Enroll to open this question.
Question 207
Write a Java program that takes a 2D array of size 2x3 and returns its transpose. 1 2 3 4 5 6…
Locked. Enroll to open this question.
Question 208
Write a Java program to search for a specific element in a 2D array and print its position (row and…
Locked. Enroll to open this question.
Question 209
Write a Java program that calculates the sum of each row in a 2D array and prints the result. Given…
Locked. Enroll to open this question.
Question 210
Write a Java program that prints the diagonal elements of a square 2D array. Given the following…
Locked. Enroll to open this question.
Question 211
Write a Java program to multiply two matrices. Ensure that the number of columns in the first…
Locked. Enroll to open this question.
Question 212
Write a Java program to sort each row of the following 2D array in ascending order. Example Input:…
Locked. Enroll to open this question.
Question 213
Write the following lava Expression :- \[ z = x^3 + y^2 - \sqrt{xy} \]
Locked. Enroll to open this question.
Question 214
Rewrite the following code using switch case statement if (value == 1) { System.out.println("1st…
Locked. Enroll to open this question.
Question 215
Write the Java expression for \[ (a + b)^x \]
Locked. Enroll to open this question.
Question 216
Evaluate the expression when the value of x = 4: \[ x *= --x + x++ + x \]
Locked. Enroll to open this question.
Question 217
Convert the following do…while loop to for loop: int x = 10; do { x––; System.out.print(x); }
Locked. Enroll to open this question.
Question 218
What is Message Passing in OOP and why is it beneficial?
Locked. Enroll to open this question.
Question 219
How does OOP help in real-world problem solving?
Locked. Enroll to open this question.
Question 220
Difference between Class and Object?
Locked. Enroll to open this question.
Question 221
What is Method Overloading? (Polymorphism)
Locked. Enroll to open this question.
Question 222
What is Method Overriding? (Runtime Polymorphism)
Locked. Enroll to open this question.
Question 223
What is the difference between Abstraction and Encapsulation?
Locked. Enroll to open this question.
Question 224
Why is modularity considered a big benefit of OOP?
Locked. Enroll to open this question.
Question 225
How does OOP support maintainability?
Locked. Enroll to open this question.
Question 226
Why is OOP better than Procedural Programming?
Locked. Enroll to open this question.
Question 227
What is Dynamic Binding and how is it useful?
Locked. Enroll to open this question.
Question 228
Explain Cohesion in OOP and why it is beneficial?
Locked. Enroll to open this question.
Question 229
Explain Coupling in OOP and its benefit?
Locked. Enroll to open this question.
Question 230
What is the benefit of OOP in large software development?
Locked. Enroll to open this question.
Question 231
Class is a ___________ of the objects.
Locked. Enroll to open this question.
Question 232
What is the benefit of using Classes and Objects?
Locked. Enroll to open this question.
Question 233
How does OOP improve security?
Locked. Enroll to open this question.
Question 234
How does OOP improve code reusability?
Locked. Enroll to open this question.
Question 235
Give the output of the following Character class methods: (a) Character.toUpperCase ('a') (b)…
Locked. Enroll to open this question.
Question 236
Rewrite the following code using the if-else statement: int m = 400; double ch = (m>300) ? (m /…
Locked. Enroll to open this question.
Question 237
Give the output of the following program segment: int n = 4279; int d; while(n > 0) { d = n % 10;…
Locked. Enroll to open this question.
Question 238
Give the output of the following String class methods: (a) "COMMENCEMENT".lastIndexOf('M') (b)…
Locked. Enroll to open this question.
Question 239
Consider the given array and answer the questions given below: int x[ ] = {4, 7, 9, 66, 72, 0, 16};…
Locked. Enroll to open this question.
Question 240
Name the following: (a) What is an instance of the class called? (b) The method which has same name…
Locked. Enroll to open this question.
Question 241
Write the value of n after execution: char ch ='d'; int n = ch + 5;
Locked. Enroll to open this question.
Question 242
What is a datatype?
Locked. Enroll to open this question.
Question 243
Can you refer to a class as a composite type / user-defined type?
Locked. Enroll to open this question.
Question 244
Can every class be referred to as a user-defined datatype?
Locked. Enroll to open this question.
Question 245
What is the main benefit of Inheritance?
Locked. Enroll to open this question.
Question 246
What is the main benefit of Polymorphism?
Locked. Enroll to open this question.
Question 247
What is Abstraction and what is its benefit?
Locked. Enroll to open this question.
Question 248
What are the 4 main pillars of OOP? (Most asked)
Locked. Enroll to open this question.
Question 249
উদ্ভিদের চলন এর উদ্দেশ্য
Locked. Enroll to open this question.
Question 250
State the package that contains the class: BufferedReader Scanner
Locked. Enroll to open this question.
Question 251
Write one difference between primitive data types and composite data types.
Locked. Enroll to open this question.
Question 252
Analyze the given program segment and answer the following questions: Write the output of the…
Locked. Enroll to open this question.
Question 253
Give the output of the following expression: a+= a++ + ++a + --a + a-- ; when a = 7
Locked. Enroll to open this question.
Question 254
Write the return type of the following library functions: isLetterOrDigit(char) replace(char, char)
Locked. Enroll to open this question.
Question 255
What is inheritance?
Locked. Enroll to open this question.
Question 256
Name the operators listed below: < ++ && ? :
Locked. Enroll to open this question.
Question 257
State the number of bytes occupied by char and int data types.
Locked. Enroll to open this question.
Question 258
Write one difference between / and % operator.
Locked. Enroll to open this question.
Question 259
String x[] = {"SAMSUNG", "NOKIA", "SONY", "MICROMAX", "BLACKBERRY"}; Give the output of the…
Locked. Enroll to open this question.
Question 260
Name the following: A keyword used to call a package in the program. Any one reference data type.
Locked. Enroll to open this question.
Question 261
What are the two ways of invoking functions?
Locked. Enroll to open this question.
Question 262
State the data type and value of res after the following is executed: char ch='t'; res=…
Locked. Enroll to open this question.
Question 263
Give the output of the following program segment and also mention the number of times the loop is…
Locked. Enroll to open this question.
Question 264
Write the output: char ch = 'F'; int m = ch; m=m+5; System.out.println(m + " " + ch);
Locked. Enroll to open this question.
Question 265
Write a Java expression for the following: \[ \begin{align} ax^5 + bx^3 + c \end{align} \]
Locked. Enroll to open this question.
Question 266
What is the value of x1 if x=5? x1= ++x – x++ + --x
Locked. Enroll to open this question.
Question 267
Convert the following while loop to the corresponding for loop: int m = 5, n = 10; while (n>=1) {…
Locked. Enroll to open this question.
Question 268
Rewrite the following using ternary operator: if (x%2 == 0) System.out.print("EVEN"); else…
Locked. Enroll to open this question.
Question 269
Write down java expression for: \[ \begin{align} \\ & T = \sqrt{A^2 + B^2 + C^2} \end{align} \]
Locked. Enroll to open this question.
Question 270
Write the output of the following program code: char ch ; int x=97; do { ch=(char)x;…
Locked. Enroll to open this question.
Question 271
Write the Java expressions for:\[ \begin{align} \\ & \frac{a^2 + b^2}{2ab} \end{align} \]
Locked. Enroll to open this question.
Question 272
If int y = 10 then find int z = (++y * (y++ + 5));
Locked. Enroll to open this question.
Question 273
Define Encapsulation.
Locked. Enroll to open this question.
Question 274
What are keywords ? Give an example.
Locked. Enroll to open this question.
Question 275
Name any two library packages.
Locked. Enroll to open this question.
Question 276
Name the type of error ( syntax, runtime or logical error) in each case given below: Math.sqrt (36…
Locked. Enroll to open this question.
Question 277
If int x[] = { 4, 3, 7, 8, 9, 10}; what are the values of p and q ? p = x.length q = x[2] + x[5] *…
Locked. Enroll to open this question.
Question 278
State the difference between == operator and equals() method.
Locked. Enroll to open this question.
Question 279
What are the types of casting shown by the following examples: char c = (char) 120; int x =…
Locked. Enroll to open this question.
Question 280
Differentiate between formal parameter and actual parameter.
Locked. Enroll to open this question.
Question 281
Write a function prototype of the following:A function PosChar which takes a string argument and a…
Locked. Enroll to open this question.
Question 282
Name any two types of access specifiers.
Locked. Enroll to open this question.
Question 283
Give the output of the following string functions: "MISSISSIPPI".indexOf('S') +…
Locked. Enroll to open this question.
Question 284
Give the output of the following Math functions: Math.ceil(4.2) Math.abs(-4)
Locked. Enroll to open this question.
Question 285
What is a parameterized constructor ?
Locked. Enroll to open this question.
Question 286
Why is an object called an instance of a class?
Locked. Enroll to open this question.
Question 287
Convert following do-while loop into for loop. int i = 1; int d = 5; do { d=d*2;…
Locked. Enroll to open this question.
Question 288
Differentiate between constructor and function.
Locked. Enroll to open this question.
Question 289
Write a Java expression for the following: \[ \frac{\sqrt{3x + x^2}}{a + b} \]
Locked. Enroll to open this question.
Question 290
What is the value of y after evaluating the expression given below? y+= ++y + y-- + --y; when int…
Locked. Enroll to open this question.
Question 291
Give the output of the following: Math.floor (-4.7) Math.ceil(3.4) + Math.pow(2, 3)
Locked. Enroll to open this question.
Question 292
Write two characteristics of a constructor.
Locked. Enroll to open this question.
Question 293
Write the output for the following: System.out.println("Incredible"+"\n"+"world");
Locked. Enroll to open this question.
Question 294
Convert the following if else if construct into switch case if( var==1) System.out.println("good");…
Locked. Enroll to open this question.
Question 295
Give the output of the following string functions: "ACHIEVEMENT".replace('E', 'A')…
Locked. Enroll to open this question.
Question 296
Consider the following String array and give the output String arr[]= {"DELHI", "CHENNAI",…
Locked. Enroll to open this question.
Question 297
Rewrite the following using ternary operator: if (bill > 10000 ) discount = bill * 10.0/100; else…
Locked. Enroll to open this question.
Question 298
Question 1
Locked. Enroll to open this question.
Question 299
(a) Write a Java expression for the following: \[ \lvert x^2 + 2xy \rvert \] (b) Write the return…
Locked. Enroll to open this question.
Question 300
(a) Differentiate between if else if and switch-case statements (b) Give the output of the…
Locked. Enroll to open this question.
Question 301
(a) Name any two basic principles of Object-oriented Programming. Answer Encapsulation Inheritance…
Locked. Enroll to open this question.
Question 302
Write the return data type of the following function. endsWith() log()
Locked. Enroll to open this question.
Question 303
Write the prototype of a function check which takes an integer as an argument and returns a…
Locked. Enroll to open this question.
Question 304
System.out.print("BEST "); System.out.println("OF LUCK"); Choose the…
Locked. Enroll to open this question.
Question 305
Write the output for the following: String s="Today is Test"; System.out.println(s.indexOf('T'));…
Locked. Enroll to open this question.
Question 306
What are the values stored in variables r1 and r2: double r1 = Math.abs(Math.min(-2.83, -5.83));…
Locked. Enroll to open this question.
Question 307
Give the output of the following code: String A ="26", B="100"; String D=A+B+"200"; int x=…
Locked. Enroll to open this question.
Question 308
Analyze the given program segment and answer the following questions: for(int i=3;i
Locked. Enroll to open this question.
Question 309
What is the difference between the Scanner class functions next() and nextLine()?
Locked. Enroll to open this question.
Question 310
State the difference between while and do while loop.
Locked. Enroll to open this question.
Question 311
Define abstraction.
Locked. Enroll to open this question.
Question 312
Differentiate between searching and sorting.
Locked. Enroll to open this question.
Question 313
How are private members of a class different from public members?
Locked. Enroll to open this question.
Question 314
lassify the following as primitive or non-primitive datatypes: char arrays int classes
Locked. Enroll to open this question.
Question 315
(a) (i) int res = 'A';What is the value of res?
Locked. Enroll to open this question.
Question 316
Give the output of the following program segment and also mention how many times the loop is…
Locked. Enroll to open this question.
Question 317
What is a keyword? List some Java keywords.
Locked. Enroll to open this question.
Question 318
Is Java case sensitive? What is the case for Java keywords?
Locked. Enroll to open this question.
Question 319
What is a comment? Is the comment ignored by the compiler? How do you denote a comment line and a…
Locked. Enroll to open this question.
Question 320
What is the statement to display a string on the console?
Locked. Enroll to open this question.
Question 321
Show the output of the following code :
Locked. Enroll to open this question.
Question 322
What is the Java source filename extension, and what is the Java bytecode file- name extension?
Locked. Enroll to open this question.
Question 323
Example of Array Declaration in Different Data Types
Locked. Enroll to open this question.
Question 324
What is the primary benefit of Encapsulation?
Locked. Enroll to open this question.
Question 325
Why Packages are used?
Locked. Enroll to open this question.
Question 326
What do you mean by Multi-threaded program?
Locked. Enroll to open this question.
Question 327
What is an assembler?
Locked. Enroll to open this question.
Question 328
What are the two ways in which Thread can be created?
Locked. Enroll to open this question.
Question 329
What is an applet?
Locked. Enroll to open this question.
Question 330
What is a high-level programming language?
Locked. Enroll to open this question.
Question 331
An applet extend which class?
Locked. Enroll to open this question.
Question 332
What is a source program?
Locked. Enroll to open this question.
Question 333
Explain garbage collection in Java?
Locked. Enroll to open this question.
Question 334
Define immutable object?
Locked. Enroll to open this question.
Question 335
Explain the usage of this() with constructors?
Locked. Enroll to open this question.
Question 336
Explain Set Interface?
Locked. Enroll to open this question.
Question 337
Explain TreeSet?
Locked. Enroll to open this question.
Question 338
What are multiprogramming, multithreading, and multiprocessing?
Locked. Enroll to open this question.
Question 339
What is Comparable Interface?
Locked. Enroll to open this question.
Question 340
Difference between throw and throws?
Locked. Enroll to open this question.
Question 341
Who invented Java? Which company owns Java now?
Locked. Enroll to open this question.
Question 342
Explain the following line used under Java Program ? public static void main (String args[ ])
Locked. Enroll to open this question.
Question 343
What is a Java applet?
Locked. Enroll to open this question.
Question 344
Define JRE i.e. Java Runtime Environment?
Locked. Enroll to open this question.
Question 345
What programming language does Android use?
Locked. Enroll to open this question.
Question 346
What is the Java language specification?
Locked. Enroll to open this question.
Question 347
What is JAR file?
Locked. Enroll to open this question.
Question 348
What is a WAR file?
Locked. Enroll to open this question.
Question 349
Define JIT compiler?
Locked. Enroll to open this question.
Question 350
What is the difference between object oriented programming language and object based programming…
Locked. Enroll to open this question.
Question 351
What is the purpose of default constructor?
Locked. Enroll to open this question.
Question 352
Can a constructor be made final?
Locked. Enroll to open this question.
Question 353
What is static block?
Locked. Enroll to open this question.
Question 354
What does IDE stand for?
Locked. Enroll to open this question.
Question 355
Are tools like NetBeans and Eclipse different languages from Java, or are they dialects or…
Locked. Enroll to open this question.
Question 356
What does JDK stand for?
Locked. Enroll to open this question.
Question 357
If your program needs to read integers, but the user entered strings, an error wouldoccur when…
Locked. Enroll to open this question.
Question 358
Suppose you write a program for computing the perimeter of a rectangle and you mistakenly write…
Locked. Enroll to open this question.
Question 359
Identify and fix the errors in the following code: 1 public class Welcome { 2 public void…
Locked. Enroll to open this question.
Question 360
What is an assembly language?
Locked. Enroll to open this question.
Question 361
What are the input and output of a Java compiler?
Locked. Enroll to open this question.
Question 362
What is the command to compile a Java program?
Locked. Enroll to open this question.
Question 363
What is the command to run a Java program?
Locked. Enroll to open this question.
Question 364
What is the JVM?
Locked. Enroll to open this question.
Question 365
Can Java run on any machine? What is needed to run Java on a computer?
Locked. Enroll to open this question.
Question 366
If a NoClassDefFoundError occurs when you run a program, what is the cause of the error?
Locked. Enroll to open this question.
Question 367
If a NoSuchMethodError occurs when you run a program, what is the cause of the error?
Locked. Enroll to open this question.
Question 368
What is the statement to display the message "Hello world" in a message dialog box?
Locked. Enroll to open this question.
Question 369
Why does the System class not need to be imported?
Locked. Enroll to open this question.
Question 370
Are there any performance differences between the following two import statements? import…
Locked. Enroll to open this question.
Question 371
Reformat the following program according to the programming style and documentation guidelines. Use…
Locked. Enroll to open this question.
Question 372
What are syntax errors (compile errors), runtime errors, and logic errors?
Locked. Enroll to open this question.
Question 373
Give examples of syntax errors, runtime errors, and logic errors.
Locked. Enroll to open this question.
Question 374
If you forget to put a closing quotation mark on a string, what kind error will be raised?
Locked. Enroll to open this question.
Question 375
The following program is wrong. Reorder the lines so that the program displays morning followed by…
Locked. Enroll to open this question.
Question 376
What do you know about Java?
Locked. Enroll to open this question.
Question 377
Why Generics are used in Java?
Locked. Enroll to open this question.
Question 378
What are the supported platforms by Java Programming Language?
Locked. Enroll to open this question.
Question 379
What is the difference between a break statement and a continue statement?
Locked. Enroll to open this question.
Question 380
Which number is denoted by leading zero in java?
Locked. Enroll to open this question.
Question 381
List any five features of Java?
Locked. Enroll to open this question.
Question 382
What is a transient variable?
Locked. Enroll to open this question.
Question 383
Why is Java Architectural Neutral?
Locked. Enroll to open this question.
Question 384
How Java enabled High Performance?
Locked. Enroll to open this question.
Question 385
If a variable is declared as private, where may the variable be accessed?
Locked. Enroll to open this question.
Question 386
Why Java is considered dynamic?
Locked. Enroll to open this question.
Question 387
What happens when a variable declaration is executed? Give an example.
Locked. Enroll to open this question.
Question 388
What is Java Virtual Machine and how it is considered in context of Java's platform independent…
Locked. Enroll to open this question.
Question 389
Importance of variable declaration and initialization
Locked. Enroll to open this question.
Question 390
Which Java operator is right associative?
Locked. Enroll to open this question.
Question 391
List two Java IDE's?
Locked. Enroll to open this question.
Question 392
What is dot operator?
Locked. Enroll to open this question.
Question 393
List some Java keywords(unlike C, C++ keywords)?
Locked. Enroll to open this question.
Question 394
What do you mean by Object?
Locked. Enroll to open this question.
Question 395
What is the difference between the >> and >>> operators?
Locked. Enroll to open this question.
Question 396
Define class?
Locked. Enroll to open this question.
Question 397
Explain the following operators: (a) ++ (Increment Operator) (b) && (Logical AND) (c) != (Not Equal…
Locked. Enroll to open this question.
Question 398
What kind of variables a class can consist of?
Locked. Enroll to open this question.
Question 399
Identify the type of expression statements: aValue=8933.234; aValue++; System.out.println("Hello…
Locked. Enroll to open this question.
Question 400
What is a Local Variable?
Locked. Enroll to open this question.
Question 401
According to Java Operator precedence, which operator is considered to be with highest precedence?
Locked. Enroll to open this question.
Question 402
What is a Instance Variable?
Locked. Enroll to open this question.
Question 403
Given the value of a variable, write a statement, without using if construct, which will produce…
Locked. Enroll to open this question.
Question 404
Question: Given the following code fragment: if (a == 0) System.out.println("Zero"); if (a == 1)…
Locked. Enroll to open this question.
Question 405
What is a Class Variable?
Locked. Enroll to open this question.
Question 406
What is Singleton class?
Locked. Enroll to open this question.
Question 407
What is the problem of dangling-else?When does it arise?What is the default dangling-else matching,…
Locked. Enroll to open this question.
Question 408
What do you mean by Constructor?
Locked. Enroll to open this question.
Question 409
Question: Rewrite the following fragment using switch: if (ch == 'E') eastern++; if (ch == 'W')…
Locked. Enroll to open this question.
Question 410
List the three steps for creating an Object for a class?
Locked. Enroll to open this question.
Question 411
Variables used in a switch statement can be used with which datatypes?
Locked. Enroll to open this question.
Question 412
Comparison between if-else if and switch-case
Locked. Enroll to open this question.
Question 413
What is the default value of byte datatype in Java?
Locked. Enroll to open this question.
Question 414
Write a difference between class and a object
Locked. Enroll to open this question.
Question 415
What is the default value of float and double datatype in Java?
Locked. Enroll to open this question.
Question 416
When a byte datatype is used?
Locked. Enroll to open this question.
Question 417
(x) Give the output of the following program segment and specify how many times the loop is…
Locked. Enroll to open this question.
Question 418
What is a static variable?
Locked. Enroll to open this question.
Question 419
(iv) Convert the given loop into exit controlled loop. int a, b; for ( a=10 , b=1; a>=1 ; a-=2) {…
Locked. Enroll to open this question.
Question 420
What do you mean by synchronized Non Access Modifier?
Locked. Enroll to open this question.
Question 421
What do you mean by Access Modifier?
Locked. Enroll to open this question.
Question 422
What is protected access modifier?
Locked. Enroll to open this question.
Question 423
What is Encapsulation?
Locked. Enroll to open this question.
Question 424
Define composition?
Locked. Enroll to open this question.
Question 425
What is final class?
Locked. Enroll to open this question.
Question 426
What is the purpose of the System class?
Locked. Enroll to open this question.
Question 427
Which class is the immediate superclass of the Container class?
Locked. Enroll to open this question.
Question 428
When parseInt() method can be used?
Locked. Enroll to open this question.
Question 429
Why is String class considered immutable?
Locked. Enroll to open this question.
Question 430
What is the default value of an object reference declared as an instance variable?
Locked. Enroll to open this question.
Question 431
What is the immediate super class of Menu?
Locked. Enroll to open this question.
Question 432
What is Nested top-level class?
Locked. Enroll to open this question.
Question 433
What is the GregorianCalendar class?
Locked. Enroll to open this question.
Question 434
Which package is used for pattern matching with regular expressions?
Locked. Enroll to open this question.
Question 435
java.util.regex consists of which classes?
Locked. Enroll to open this question.
Question 436
What is the SimpleTimeZone class?
Locked. Enroll to open this question.
Question 437
Can a vector contain heterogenous objects?
Locked. Enroll to open this question.
Question 438
Can a class declared as private be accessed outside it's package?
Locked. Enroll to open this question.
Question 439
What is an Exception?
Locked. Enroll to open this question.
Question 440
What is an object's lock and which object's have locks?
Locked. Enroll to open this question.
Question 441
What do you mean by Checked Exceptions?
Locked. Enroll to open this question.
Question 442
What are order of precedence and associativity and how are they used?
Locked. Enroll to open this question.
Question 443
Explain Runtime Exceptions?
Locked. Enroll to open this question.
Question 444
If a method is declared as protected, where may the method be accessed?
Locked. Enroll to open this question.
Question 445
Which are the two subclasses under Exception class?
Locked. Enroll to open this question.
Question 446
When throws keyword is used?
Locked. Enroll to open this question.
Question 447
What is the difference between inner class and nested class?
Locked. Enroll to open this question.
Question 448
When throw keyword is used?
Locked. Enroll to open this question.
Question 449
What will be the default values of all the elements of an array defined as an instance variable?
Locked. Enroll to open this question.
Question 450
How will you define a software object?
Locked. Enroll to open this question.
Question 451
How finally used under Exception Handling?
Locked. Enroll to open this question.
Question 452
What things should be kept in mind while creating your own exceptions in Java?
Locked. Enroll to open this question.
Question 453
Define class and object with an example.
Locked. Enroll to open this question.
Question 454
Why is Java called an object-oriented programming language?
Locked. Enroll to open this question.
Question 455
What are the four key features of an object?
Locked. Enroll to open this question.
Question 456
What is Method/function overloading?
Locked. Enroll to open this question.
Question 457
What is Method/function overriding?
Locked. Enroll to open this question.
Question 458
Difference between Overloading and Overriding?
Locked. Enroll to open this question.
Question 459
What is runtime polymorphism or dynamic method dispatch?
Locked. Enroll to open this question.
Question 460
What restrictions are placed on method overriding?
Locked. Enroll to open this question.
Question 461
What is finalize() method?
Locked. Enroll to open this question.
Question 462
What's the difference between constructors and other methods?
Locked. Enroll to open this question.
Question 463
Can you call one constructor from another if a class has multiple constructors?
Locked. Enroll to open this question.
Question 464
Can constructor be inherited?
Locked. Enroll to open this question.
Question 465
Where and how can you use a private constructor?
Locked. Enroll to open this question.
Question 466
What is constructor chaining and how is it achieved in Java?
Locked. Enroll to open this question.
Question 467
What is the default constructor?
Locked. Enroll to open this question.
Question 468
Rules for creating Java constructor
Locked. Enroll to open this question.
Question 469
When is a constructor called
Locked. Enroll to open this question.
Question 470
Types of Java constructors in Java
Locked. Enroll to open this question.
Question 471
What is the purpose of a default constructor?
Locked. Enroll to open this question.
Question 472
Why use the parameterized constructor in Java?
Locked. Enroll to open this question.
Question 473
Difference between constructor and method in Java
Locked. Enroll to open this question.
Question 474
Can constructor perform other tasks instead of initialization?
Locked. Enroll to open this question.
Question 475
What is Constructor Overloading in Java?
Locked. Enroll to open this question.
Question 476
Can a top level class be private or protected?
Locked. Enroll to open this question.
Question 477
What is an instance method in OOP, and how does it differ from a static method?
Locked. Enroll to open this question.
Question 478
Can instance methods access static members of a class in X++? Explain.
Locked. Enroll to open this question.
Question 479
Why would you choose to use a static method over an instance method in OOP?
Locked. Enroll to open this question.
Question 480
What is recursion?
Locked. Enroll to open this question.
Question 481
What is a recursive function?
Locked. Enroll to open this question.
Question 482
How is recursion different from a normal function call?
Locked. Enroll to open this question.
Question 483
What is direct recursion?
Locked. Enroll to open this question.
Question 484
What is the mathematical idea behind recursion?
Locked. Enroll to open this question.
Question 485
Write a Java program to demonstrate recursion.
Locked. Enroll to open this question.
Question 486
Why is the compute() method recursive? return n * compute(n - 1);
Locked. Enroll to open this question.
Question 487
Why is a class known as composite data type?
Locked. Enroll to open this question.
Question 488
A statement is given as: 'Study_Table' is an object of the class 'Furniture'. Write down Java…
Locked. Enroll to open this question.
Question 489
Class and Objects are inter-related. Explain.
Locked. Enroll to open this question.
Question 490
Why is an Object called an 'Instance' of a class? Explain.
Locked. Enroll to open this question.
Question 491
Write a statement to create an object 'Keyboard' of the class 'Computer'.
Locked. Enroll to open this question.
Question 492
What is NullPointerException?
Locked. Enroll to open this question.
Question 493
Mention three characteristics and two methods for the following Classes: (a) class Mobile Phone (b)…
Locked. Enroll to open this question.
Question 494
What are the ways in which a thread can enter the waiting state?
Locked. Enroll to open this question.
Question 495
Design a program in Java to calculate the discount given to a customer on purchasing LED…
Locked. Enroll to open this question.
Question 496
How does multi-threading take place on a computer with a single CPU?
Locked. Enroll to open this question.
Question 497
Define Inheritance?
Locked. Enroll to open this question.
Question 498
What invokes a thread's run() method?
Locked. Enroll to open this question.
Question 499
Does it matter in what order catch statements for FileNotFoundException and IOException are written?
Locked. Enroll to open this question.
Question 500
When super keyword is used?
Locked. Enroll to open this question.
Question 501
Is there any limitation of using Inheritance?
Locked. Enroll to open this question.
Question 502
What is the difference between yielding and sleeping?
Locked. Enroll to open this question.
Question 503
How inheritance supports reusability?
Locked. Enroll to open this question.
Question 504
Write the general syntax of inheritance.
Locked. Enroll to open this question.
Question 505
Attributes, Fields, Properties, Member Variables, Instance Variables, Object Variables, and Class…
Locked. Enroll to open this question.
Question 506
What are Wrapper classes?
Locked. Enroll to open this question.
Question 507
What is the difference between a Window and a Frame?
Locked. Enroll to open this question.
Question 508
What is an Interface?
Locked. Enroll to open this question.
Question 509
Which package has light weight components?
Locked. Enroll to open this question.
Question 510
Give some features of Interface?
Locked. Enroll to open this question.
Question 511
What is a finally block? When and how is it used? Give an example.
Locked. Enroll to open this question.
Question 512
What is the difference between the paint() and repaint() methods?
Locked. Enroll to open this question.
Question 513
What is the purpose of File class?
Locked. Enroll to open this question.
Question 514
Name the block that encloses the code that may encounter anomalous situations.
Locked. Enroll to open this question.
Question 515
What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream…
Locked. Enroll to open this question.
Question 516
In which block can you throw the exception?
Locked. Enroll to open this question.
Question 517
Which class should you use to obtain design information about an object?
Locked. Enroll to open this question.
Question 518
Which block traps and handles an exception?
Locked. Enroll to open this question.
Question 519
Can one catch block sufficiently trap and handle multiple exceptions?
Locked. Enroll to open this question.
Question 520
What is the difference between static and non-static variables?
Locked. Enroll to open this question.
Question 521
What is Serialization and deserialization?
Locked. Enroll to open this question.
Question 522
Which block is always executed no matter which exception is thrown?
Locked. Enroll to open this question.
Question 523
NumberFormatException is subclass of which exception class?
Locked. Enroll to open this question.
Question 524
What are use cases?
Locked. Enroll to open this question.
Question 525
IOException is subclass of which exception class?
Locked. Enroll to open this question.
Question 526
Explain the use of sublass in a Java program?
Locked. Enroll to open this question.
Question 527
How to add menushortcut to menu item?
Locked. Enroll to open this question.
Question 528
What is the role of (i) throws keyword ? (ii) throw keyword ?
Locked. Enroll to open this question.
Question 529
Why is exception handling necessary?
Locked. Enroll to open this question.
Question 530
Can you write a Java class that could be used both as an applet as well as an application?
Locked. Enroll to open this question.
Question 531
What is the difference between Swing and AWT components?
Locked. Enroll to open this question.
Question 532
How do you throw an exception?
Locked. Enroll to open this question.
Question 533
How do you handle an exception? Describe the keyword try. How is it used?
Locked. Enroll to open this question.
Question 534
What is the root class for all exceptions?
Locked. Enroll to open this question.
Question 535
What type of exceptions require the caller to explicitly handle them?
Locked. Enroll to open this question.
Question 536
When is the ArrayStoreException thrown?
Locked. Enroll to open this question.
Question 537
What type of exceptions do not require the caller to explicitly handle them?
Locked. Enroll to open this question.
Question 538
What is the throws keyword, and how does it differ from the throw keyword?
Locked. Enroll to open this question.
Question 539
What's the difference between the methods sleep() and wait()?
Locked. Enroll to open this question.
Question 540
Which of the following code fragments will throw an ArrayIndexOutOfBoundsException?
Locked. Enroll to open this question.
Question 541
Which code fragment will throw an ArrayIndexOutOfBoundsException?
Locked. Enroll to open this question.
Question 542
What is synchronization?
Locked. Enroll to open this question.
Question 543
Write a try/catch block that throws an Exception if the value of variable X is less than zero. The…
Locked. Enroll to open this question.
Question 544
What is the Collections API?
Locked. Enroll to open this question.
Question 545
What line of a given program will throw FileNotFoundException?
Locked. Enroll to open this question.
Question 546
Create a try block that can generate three types of exceptions and handle them with multiple catch…
Locked. Enroll to open this question.
Question 547
Does garbage collection guarantee that a program will not run out of memory?
Locked. Enroll to open this question.
Question 548
When ArithmeticException is thrown?
Locked. Enroll to open this question.
Question 549
The immediate super class of the Applet class?
Locked. Enroll to open this question.
Question 550
What class of exceptions are generated by the Java run-time system?
Locked. Enroll to open this question.
Question 551
Which arithmetic operations can result in the throwing of an ArithmeticException?
Locked. Enroll to open this question.
Question 552
Variable of the boolean type is automatically initialized as?
Locked. Enroll to open this question.
Question 553
What is the difference between error and an exception?
Locked. Enroll to open this question.
Question 554
List primitive Java types?
Locked. Enroll to open this question.
Question 555
Write general syntax of try-catch block
Locked. Enroll to open this question.
Question 556
What is an Exception in Java?
Locked. Enroll to open this question.
Question 557
What is the relationship between clipping and repainting under AWT?
Locked. Enroll to open this question.
Question 558
How Java Handles Exceptions
Locked. Enroll to open this question.
Question 559
Types of Exceptions
Locked. Enroll to open this question.
Question 560
Example: IOException
Locked. Enroll to open this question.
Question 561
Under what conditions is an object's finalize() method invoked by the garbage collector?
Locked. Enroll to open this question.
Question 562
Example: ArithmeticException
Locked. Enroll to open this question.
Question 563
How can a dead thread be restarted?
Locked. Enroll to open this question.
Question 564
Example: NullPointerException
Locked. Enroll to open this question.
Question 565
Example: ArrayIndexOutOfBoundsException
Locked. Enroll to open this question.
Question 566
Example: NumberFormatException
Locked. Enroll to open this question.
Question 567
What are ClassLoaders?
Locked. Enroll to open this question.
Question 568
Example: StackOverflowError
Locked. Enroll to open this question.
Question 569
Example: OutOfMemoryError
Locked. Enroll to open this question.
Question 570
What are the types of program errors?
Locked. Enroll to open this question.
Question 571
What will happen if static modifier is removed from the signature of the main method?
Locked. Enroll to open this question.
Question 572
When is Exception Handling required?
Locked. Enroll to open this question.
Question 573
What is the function of the catch block in exception handling? Where does it appear in a program?…
Locked. Enroll to open this question.
Question 574
What are the advantages of exception handling?
Locked. Enroll to open this question.
Question 575
Why do we need wrapper classes?
Locked. Enroll to open this question.
Question 576
Advantages of Exception Handling
Locked. Enroll to open this question.
Question 577
Why do you need multiple catch handlers?
Locked. Enroll to open this question.
Question 578
When a thread is created and started, what is its initial state?
Locked. Enroll to open this question.
Question 579
What is wrong with this fragment?
Locked. Enroll to open this question.
Question 580
The finally block is the last bit of code executed before your program ends. True or False? Explain.
Locked. Enroll to open this question.
Question 581
What is the Locale class?
Locked. Enroll to open this question.
Question 582
What are synchronized methods and synchronized statements?
Locked. Enroll to open this question.
Question 583
What type of exceptions must be explicitly declared in a throws clause of a method?
Locked. Enroll to open this question.
Question 584
What are the two direct subclasses of the Throwable class?
Locked. Enroll to open this question.
Question 585
What are the three ways that an exception can be generated?
Locked. Enroll to open this question.
Question 586
What is Dynamic Binding(late binding)?
Locked. Enroll to open this question.
Question 587
What happens when you run a program that creates an array of ints and then sets a value beyond its…
Locked. Enroll to open this question.
Question 588
What is the purpose of the finally clause in a try-catch-finally statement?
Locked. Enroll to open this question.
Question 589
What are the advantages of ArrayList over arrays?
Locked. Enroll to open this question.
Question 590
Why deletion in LinkedList is fast than ArrayList?
Locked. Enroll to open this question.
Question 591
What classes of exceptions may be caught by a catch clause?
Locked. Enroll to open this question.
Question 592
How do you decide when to use ArrayList and LinkedList?
Locked. Enroll to open this question.
Question 593
Can an exception be rethrown?
Locked. Enroll to open this question.
Question 594
What class of exceptions are generated by the Java run-time system?
Locked. Enroll to open this question.
Question 595
What happens if a try-catch-finally statement does not have a catch clause to handle an exception…
Locked. Enroll to open this question.
Question 596
How does a try statement determine which catch clause should be used to handle an exception?
Locked. Enroll to open this question.
Question 597
What is the difference between Exception and Error?
Locked. Enroll to open this question.
Question 598
What is type casting?
Locked. Enroll to open this question.
Question 599
What is the difference between throw and throws clause?
Locked. Enroll to open this question.
Question 600
Describe life cycle of thread?
Locked. Enroll to open this question.
Question 601
What would be printed by the following code segment if someValue equals 1000?
Locked. Enroll to open this question.
Question 602
Which method of the Component class is used to set the position and size of a component?
Locked. Enroll to open this question.
Question 603
What are program errors? What are the types of program errors?
Locked. Enroll to open this question.
Question 604
What is the range of the short type?
Locked. Enroll to open this question.
Question 605
How are compile-time errors different from run-time errors?
Locked. Enroll to open this question.
Question 606
What are the types of compile-time errors?
Locked. Enroll to open this question.
Question 607
What are logical errors? Why are they hard to find?
Locked. Enroll to open this question.
Question 608
Does Java allow Default Arguments?
Locked. Enroll to open this question.
Question 609
How will you handle compile-time errors?
Locked. Enroll to open this question.
Question 610
Which number is denoted by leading 0x or 0X in java?
Locked. Enroll to open this question.
Question 611
How will you handle logical errors?
Locked. Enroll to open this question.
Question 612
Can try statements be nested?
Locked. Enroll to open this question.
Question 613
Break statement can be used as labels in Java?
Locked. Enroll to open this question.
Question 614
Is it necessary that each try block must be followed by a catch block?
Locked. Enroll to open this question.
Question 615
Where import statement is used in a Java program?
Locked. Enroll to open this question.
Question 616
Explain suspend() method under Thread class.
Locked. Enroll to open this question.
Question 617
How does a try statement determine which catch clause should be used to handle an exception?
Locked. Enroll to open this question.
Question 618
Explain isAlive() method under Thread class?
Locked. Enroll to open this question.
Question 619
What do you mean by try-catch block?
Locked. Enroll to open this question.
Question 620
What is currentThread()?
Locked. Enroll to open this question.
Question 621
What is the difference between byte oriented IO and character oriented IO ? How are these two…
Locked. Enroll to open this question.
Question 622
Explain main thread under Thread class execution?
Locked. Enroll to open this question.
Question 623
What is an exception ?
Locked. Enroll to open this question.
Question 624
Life cycle of an applet includes which steps?
Locked. Enroll to open this question.
Question 625
When is Exception Handling required ?
Locked. Enroll to open this question.
Question 626
Why is the role of init() method under applets?
Locked. Enroll to open this question.
Question 627
What is the function of catch block in exception handling ? Where does it appear in a program ?
Locked. Enroll to open this question.
Question 628
What are the advantages of exception handling ?
Locked. Enroll to open this question.
Question 629
Which method is called by Applet class to load an image?
Locked. Enroll to open this question.
Question 630
When do use need multiple catch handlers ?
Locked. Enroll to open this question.
Question 631
Define code as an attribute of Applet?
Locked. Enroll to open this question.
Question 632
Differentiate between String and StringBuffer objects.
Locked. Enroll to open this question.
Question 633
Define canvas?
Locked. Enroll to open this question.
Question 634
Given a package named EDU.Student, how would you import a class named Test contained in this…
Locked. Enroll to open this question.
Question 635
Define Network Programming?
Locked. Enroll to open this question.
Question 636
What is a Socket?
Locked. Enroll to open this question.
Question 637
There are three classes that implement the DataInput and DataOutput interfaces. Two of them are…
Locked. Enroll to open this question.
Question 638
Advantages of Java Sockets?
Locked. Enroll to open this question.
Question 639
What will be the output of the following code snippet when combined with suitable declarations and…
Locked. Enroll to open this question.
Question 640
Disadvantages of Java Sockets?
Locked. Enroll to open this question.
Question 641
Give the output of the following program
Locked. Enroll to open this question.
Question 642
Which class is used by server applications to obtain a port and listen for client requests?
Locked. Enroll to open this question.
Question 643
Consider the following try .... catch block:
Locked. Enroll to open this question.
Question 644
Which class represents the socket that both the client and server use to communicate with each…
Locked. Enroll to open this question.
Question 645
What is the output of the following code fragment if "abc" is passed as argument to the func( ) ?
Locked. Enroll to open this question.
Question 646
Predefined classes are available in the form of _________.
Locked. Enroll to open this question.
Question 647
What environment variables do I need to set on my machine in order to be able to run Java programs?
Locked. Enroll to open this question.
Question 648
Name the package you need to import for performing input and output.
Locked. Enroll to open this question.
Question 649
Is there any need to import java.lang package?
Locked. Enroll to open this question.
Question 650
Which streams are by default available in a Java program?
Locked. Enroll to open this question.
Question 651
Which class stores the information about the connection between an input device and the computer or…
Locked. Enroll to open this question.
Question 652
What is Externalizable interface?
Locked. Enroll to open this question.
Question 653
Name the class that translates data bytes received from InputStream objects into a stream of…
Locked. Enroll to open this question.
Question 654
If System.exit (0); is written at the end of the try block, will the finally block still execute?
Locked. Enroll to open this question.
Question 655
Which class buffers the input received from an InputStreamReader object?
Locked. Enroll to open this question.
Question 656
What is daemon thread?
Locked. Enroll to open this question.
Question 657
Which package is by default imported in every Java program?
Locked. Enroll to open this question.
Question 658
Which method is used to create the daemon thread?
Locked. Enroll to open this question.
Question 659
Name the block that encloses the code that may encounter anomalous situations.
Locked. Enroll to open this question.
Question 660
Which method must be implemented by all threads?
Locked. Enroll to open this question.
Question 661
In which block can you throw the exception?
Locked. Enroll to open this question.
Question 662
Which block traps and handles an exception?
Locked. Enroll to open this question.
Question 663
Can one catch block sufficiently trap and handle multiple exceptions?
Locked. Enroll to open this question.
Question 664
Which block is always executed no matter which exception is thrown?
Locked. Enroll to open this question.
Question 665
What is the difference between the size and capacity of a Vector?
Locked. Enroll to open this question.
Question 666
NumberFormatException is subclass of which exception class?
Locked. Enroll to open this question.
Question 667
What is an enumeration?
Locked. Enroll to open this question.
Question 668
IOException is subclass of which exception class?
Locked. Enroll to open this question.
Question 669
What is the role of(i) throws keyword?(ii) throw keyword?
Locked. Enroll to open this question.
Question 670
What is difference between Path and Classpath?
Locked. Enroll to open this question.
Question 671
Why is exception handling necessary?
Locked. Enroll to open this question.
Question 672
Difference between equals() and equalsIgnoreCase() string functions?
Locked. Enroll to open this question.
Question 673
What are the restriction imposed on a static method or a static block of code?
Locked. Enroll to open this question.
Question 674
Difference between length() and capacity() string functions?
Locked. Enroll to open this question.
Question 675
Can an Interface extend another Interface?
Locked. Enroll to open this question.
Question 676
The default package is a package without any name and is imported for you.
Locked. Enroll to open this question.
Question 677
Which object oriented Concept is achieved by using overloading and overriding?
Locked. Enroll to open this question.
Question 678
Which command creates a package in Java?
Locked. Enroll to open this question.
Question 679
How many bits are used to represent Unicode, ASCII, UTF-16, and UTF-8 characters?
Locked. Enroll to open this question.
Question 680
What is Downcasting?
Locked. Enroll to open this question.
Question 681
What is the difference between StringBuffer and StringBuilder class?
Locked. Enroll to open this question.
Question 682
Why is StringBuffer called mutable?
Locked. Enroll to open this question.
Question 683
Why Vector class is used?
Locked. Enroll to open this question.
Question 684
What is a Values Collection View ?
Locked. Enroll to open this question.
Question 685
What is Polymorphism?
Locked. Enroll to open this question.
Question 686
Can a double value be cast to a byte?
Locked. Enroll to open this question.
Question 687
Discuss polymorphism using real-life example.
Locked. Enroll to open this question.
Question 688
What is Abstraction?
Locked. Enroll to open this question.
Question 689
What is Abstract class?
Locked. Enroll to open this question.
Question 690
What is the numerical range of a char data type in Java?
Locked. Enroll to open this question.
Question 691
When Abstract methods are used?
Locked. Enroll to open this question.
Question 692
What is the difference between an Interface and an Abstract class?
Locked. Enroll to open this question.
Question 693
Define Packages in Java?
Locked. Enroll to open this question.
Question 694
What are the supported platforms by Java Programming Language?
Locked. Enroll to open this question.
Get Java Fundamentals: Building Strong Foundations updates by email
Short, practical lessons and course updates from Rumman Ansari. No spam.