Warning: Undefined array key 1 in /home/acaproso/public_html/._System/._Template/.Main.php on line 116
Object oriented concepts questions.

Object oriented concepts questions.

Find Object oriented concepts university examination questions in acaproso.com

# Question
1

What is the output of the following program ?
public class Watoto extends Wazazi{
public void doSomething(){
System.out.println("Parents care children");
}
}
public class Supplementary{
public static void main(String[]args){
Watoto c= new Wazazi();
c.doSomething();
}
}
class Watoto{
public void doSomething(){
System.out.println("Children cry");
}
}


Short answers
2

Define this terms and provide an example.
Array and Multidimentional array.


Short answers
3

Correct if there is any error and state what will be the output
public class Test2D{
public static void main(String[]args){
int[][]m={
{15,25,35},{35,45,50}
}
int sum;
sum=0;
for(int i=0;i<2;i++)
for(int j=0;j<2;j++)
sum+=m[i][j];
System.out.println(sum);
}
}


Short answers
4

Java has three type of control structure discuss them and provide one example for each.


Short answers
5

Differentiate betwween the following control loop if and nested if


Short answers
6

Write the following code into condition operator
if(gender==1)
System.out.println("Woman");
else
System.out.println("Man");


Short answers
7

Write a Java statement to accomplish each of the following tasks
Declare variables sum and x to be of type int.
Assign 1 to variable x.
Assign 0 to variable sum.
Add variable sum, and assign the result to variable sum.
Print "The sum is:", followed by the value of the variable sum.


Practical
8

What is the output of the following programs
Prog#1
public class Break Test{
public static void main(String[]args){
int count;
for(count=1; count≤20; count++){
if(count==8)
break;
System.out.println(count);
}
}
}


Prog#2
public class ContinueTest{
public static void main(String[]args){
for(int count=1;count≤10;count++){
if(count==5)
continue;
System.out.println(count);
}
}
}


Short answers
9

What will be the out put of the following for-loop ?
for(int i=1; i<7; i++){
System.out.println(i);


Short answers
10

Data type are categorized into two , mention and differentiate them.


Short answers