Please select a subject first
Advertisements
Advertisements
What is a parameterized constructor?
Concept: Features of a Constructor
Name the two types of constructors.
Concept: Features of a Constructor
Write two characteristics of a constructor.
Concept: Need of using a Constructor
Write the output of the following program code:
char ch ;
int x=97;
do
{
ch=(char) x;
System.out.print(ch + “ ” );
if(x%10 == 0)
break;
++x;
}while(x<=100);
Concept: Features of a Constructor
when is a constructor invoked?
Concept: Concept of Constructor
The absence of which statement leads to fall through situation in switch case statement?
Concept: Introduction of Conditional Statements in Java
Consider the following program segment and select the output of the same when n = 10:
switch(n)
{Case 10: System.out.println(0*2);
case 4: System.out.println(n*4); break;
default : Syslem.out.println(n);
}Concept: Introduction of Conditional Statements in Java
Rewrite the following code using the if-else statement:
int m = 400;
double cl). = (m>300) ? (m/10.0) * 2; (m/20.0) - 2;Concept: Introduction of Conditional Statements in Java
Give the output of the following program segment:
int n = 4279; int d;
while(n>0)
(d=n%10;
System.out.println(d);
n=n/100;
}Concept: Introduction of Conditional Statements in Java
Name the following:
The method which has same name as that of the class name.
Concept: Concept of Constructor
Which of the following data type cannot be used with switch case construct?
Concept: Introduction of Conditional Statements in Java
If the name of the class is "Yellow", what can be the possible name for its constructors?
Concept: Types of Constructor
Which of the following is not true with regards to a switch statement?
Concept: Introduction of Conditional Statements in Java
Rewrite the following code using single if statement.
if(code=='g')
System.out.println("GREEN");
else if(code=='G')
System.out.println("GREEN");Concept: Introduction of Conditional Statements in Java
A student executes the following program segment and gets an error. Identify the statement which has an error, correct the same to get the output as WIN.
boolean x=true;
switch(x)
{ case 1:System.out.println("WIN");break;
case 2;System.out.println("LOOSE");
}Concept: Introduction of Conditional Statements in Java
Consider the following program segment and answer the questions below:
class calculate
{
int a;double b;
calculate()
{
a=0;
b=0.0;
}
calculate(int x, double y)
{
a=x;
b=y;
}
void sum()
{
System.out.println(a*b);
}}
Name the type of constructors used in the above program segment.
Concept: Features of a Constructor
Identify and name the following tokens:
(i) public
(ii) ‘a’
(iii) ==
(iv) {}
Concept: Introduction to Encapsulation
Using the switch-case statement, write a menu driven program to do the following :
(a) To generate and print Letters from A to Z and their Unicode Letters Unicode

(b) Display the following pattern using iteration (looping) statement: 1

Concept: Introduction of Iterative Constructs in Java
Define Encapsulation.
Concept: Scope of Variables in Java
Name any two types of access specifiers.
Concept: Introduction to Encapsulation
