XII-IP MONTHLY TEST JULY 2013 SAMPLE PAPER
KENDRIYA VIDYALAYA NO. 1 , NAUSENABAUGH,
VISAKHAPATNAM
Monthly Test (July-2013) SAMPLE PAPER Subject : Informatics Practices
Class : XII Section
: C Duration: 90 Min. Max Marks :40
Attempt all questions.
1.Rewrite the following code fragment using do-while
loop and also give output : 4M
for(int
i=1;i<=10;i++)
{
System.out.println(“”+i);
}
2. How many times will each
of the following loops execute? Which one of these is an entry control loop and
which one is an exit control loop? 4M
Loop1:
int
sum = 0, i = 5;
while
(i<5)
{sum
+= i;i++;}
Loop2:
int
sum = -30, i = -5;
do
{
sum += i;i++;} while (i<5);
3. What
will be the content of jTextField1 after executing the following code: 2M
int
Num = 6;
Num
-= 3;
if
( Num > 5)
jTextField1.setText(Integer.toString(Num));
else
jTextField1.setText(Integer.toString(Num+5));
4. What will be the contents of jTextArea1 after executing the
following statement: 2M
jTextArea1.setText("Object\nOriented\tProgramming\n
In Java");
5.
Rewrite the following program code using switch statement: 4M
int
d; String day;
if
(d == 1)
day
= "Monday";
else
if (d == 2)
day
= "Tuesday";
else
if (d == 3)
day
= "Wednesday";
else day
= "-";
6. Find the output of the following code
(I) if
ch=’B’ (II) if ch=’D’ (III)if ch=’P’
(IV) if ch= ‘A’ 4M
switch(ch)
{
case ‘A’ : System.out.println(
‘A’);
case ‘B’ : System.out.println(‘B’);
case ‘C’ : System.out.println(‘C’);
break;
case ‘D’
: System.out.println(‘D’);
default : System.out.println(‘F’);
}
7.The following code has some
error(s). Rewrite the correct code underlining all the corrections made. 4M
Int
y==3;
Switch(y);
{ Case=
1 : System.out.print(“Yes its
One”)
break;
Case>=2 :
System.out.println(“Yes its more than Two”)
break;
case
else : System.out.print(“Invalid Number);
Break;
}
8.What is Inheritance ?
Explain Different Types of
Inheritance? 4M
9.What is Encapsulation in OOP
? 2M
10.Explain the concept of Function
Overloading with Example /Code ? 4M
11.What are the advantages of
Inheritance ? 2M
12.Write a program to display
all the even natural number lying in the
range 20 to 100 . 4M
*****************
THE END*********************