Sunteți pe pagina 1din 6

KENDRIYA VIDYALAYA FORTWILLIAM

CLASS 12 –IP 2018-19


MONTHLY TEST JULY
1. (a) ABC Company wants to link its computers in the Head office in New Delhi to its office in Sydney. Name the type of
Network that will be formed. Which Communication media should be used to form this Network ? 2

(b) Which of the following is/are not communication media ?

(i) Microwaves (ii) Optical Fiber cable (iii) Node (iv) Radio waves

Identify which of the above mentioned communication media are Wired media and which ones are Wireless media. 2

(c) Write two examples each of software in the following categories : 2

(i) Open Source Operating System (ii) Open Source Web Browser

(d) Expand the following terms : 2

(i) GSM (ii) IP

2. Name the devices : 2

(i) This device constantly looks at all the data entering and exiting your connection. It can block or reject data in response
to an established rule.

(ii) This device connects multiple nodes to form a network. It redirects the received information only to the intended
node(s).

3. (a) Identify the invalid variable names. Sate the reason if invalid. 1

(i) Marks Unit (ii) Product_1 (iii) Sales123 (iv) 2Marks

(b) Write the data type of variables that should be used to store : 1

(i) Marks of students (ii) Grades of students (Grade can be ‘A’ or ‘B’ or ‘C’)

(c) Write examples of any two properties and any two methods of jButton component. 1

(d)Distinguish between ComboBox and ListBox.

(e)When would you prefer using them over Radiobutton and Checkbox ? 2

(f) Rewrite the following code using switch statement : 2

if (code == ‘A’) allowance = 3500;

else if (code ==’B’) allowance= 3200;

else allowance =2000;

4.(a)Identify the error in the following code : 1

switch(c) {

case 9.0 : a= a+2;

break;

case 8.0 : a=a+3;

break; }
(b) What values will be displayed in JOptionPane when the following code is executed ? 2

int a=5, b = 2;

while (a < 20)

{ a = a + b; b = a  b;

JOptionPane.showMessageDialog(null,a); }

(c) Write the code given below using ‘for’ loop instead of ‘while’ loop : 2

inti=1;

while(i<=5)

{ if(i * i == 4)

jTextField1.setText(""+i);

i=i+1; }

(d) Write the value that will be stored in variable a after execution of the following code if : 2

5. (i) initial value of a is 8. (ii) initial value of a is 10.

int b = 9;

if (a > b)

a=a+5;

a=a+2;

6.What will be the values of i and z after the following code is executed : 2

inti = 0;

int z = 10;

do

{ i = i+2; z; }

while (i<10);

7. Ms. Priya works as a programmer in ‘‘Avon Education’’ where she has designed a software to compute fee charges to
be paid by the students. A screenshot of the same is shown below :
Any one Course out of Pharmacy, Architecture and Arts & Design is chosen by the user.

 If the student is eligible for Concession, the required checkbox is selected by the user.

 Based on the course selected, Fee Per Quarter is displayed in the appropriate textfield according to the following
criterion : Course Fee Per Quarter Pharmacy 2000.00 ,Architecture 2500.00 ,Arts & Design 2300.00

 If the student is eligible for Concession, a concession of 7% of Fee per quarter is calculated as the concession amount,
otherwise concession amount is 0.

 Fee to be paid is the Fee per quarter with the concession amount (if any) deducted from it. Help Ms. Priya in writing the
code to do the following :

(i) When ‘Calculate Charges’ button is clicked, ‘Fee per quarter’, ‘Concession Amount’, ‘Fee to be Paid’ should be
calculated and displayed in the respective text fields. 4

ii) When ‘CLEAR’ button is clicked, all the textfields, radiobuttons and checkbox should be cleared. 1

(iii) When ‘Exit’ button is clicked, the application should close. 1

8.

(a) Write the value that will be assigned to variable x after executing the following statement : 1
x = 3 + 36/12 + 2*5;
(b) Distinguish between parselnt() and parseDouble() methods. 1
(c) What values will be assigned to b, r and t after execution of the following code : 2
for(inti = 0; i<= 2; i++)
{ switch(i)
{ case 1:
{ b=i; break; }
case 2:
{ r=i; break; }
default:{ t=i; } } }
(d) Write the values of num2 and num3 after execution of following code : 1
int num1, num2, num3;
num1 = 100;
num2 = ++num1;
num3 = num2++ + ++num1;
(e) Write the purpose of lineWrap property of TextArea? 1
(f) Write the values that will be assigned to a, b, c and m after executing the following Java code : 2
String p, q, r, a, b, c;
int m; p = “AISSE2017”;
q = “Learning Java”;
r = “ ProgrammingFun ”;
a = p.substring(3,6);
b = q.concat(p);
c = r.trim();
m = c.length();
(g) Mr. Kunal works as a programmer in “Delicious IceCream” parlour where he has designed a software to compute
charges to be paid by the customer. A screenshot of the same is shown below :

A customer can take any icecream out of 1 Scoop/ 2 Scoops/ IceCream Sundae. A customer can also opt for one,
two or all three toppings over IceCream. Charges of toppings are extra. Each toppings is for 30.00. For example if
two toppings are chosen, 60.00 will be displayed as Toppings Charges. Help Mr. Kunal in writing the code to do
the following :
(h) After selecting appropriate Radio Button and checkbox(es), (if required), when ‘Calculate Amount’ button is
clicked, IceCream charges, Toppings Charges and ‘Total Amount to Pay’ should be calculated and displayed in the
respective text fields. 3
(i) Charges for IceCreams are as follows : Type of IceCreamIceCream

8. What are the similarities and differences between bus and tree topologies? 1
9. What do you understand by domain name resolution? 1
10. Find the output of the following code snippet written in java 3
public static void main(String args[])
{
int x=1,y=1,z=1,i=1;
while(y<=3)
{
z=1;
while(z<=y)
{
x=x*i;
i++; z++;
}
System.out.println("x= "+x);
y++;
}
}
11. What does the following fragment display 1
String s = “Six:” + 3+ 3;
System.out.println(s);
12. a) Write java statement to extract selected item from a given listbox named as “jList1”. 1

b) Amit created a program using switch case. He used the data type double for selection variable. Is it correct to define
selection variable as double? Give reason. 1
c) Write the output in jTextField1 if depcode is 3. 2
switch (depcode)
{
case 1 :
allowance=4000;
break;
case 2 :
allowance=3200;
break;
default :
allowance=1000;
}
jTextFieldl.setText( " " +allowance);

(d) Write Java code (statements) to declare Y as integer variable. Then, assign the value 30 to a
variable Y. Increase the value of Y by 5 and store the increased value in Z. 1
(e) Write the contents of jTextField1, jTextField2, jTextField3 and jTextField4 when the following
statements are executed : 4
String x;
String str = “Java”;
x = str.concat (“study”);
double a = 7.8765;
jTextField1.setText (x.length()+“ ”);
jTextField2.setText (x.toUpperCase () );
jTextField3.setText (x.substring (2,5));
jTextField4.setText (Math.round(7.8765)+“ ”);
13.(a) Shalini is learning Java programming language, as it allows developers to write code that can run on
any machine, regardless of architecture or platform. Help her in finding solutions of her problems: 2
I. She wants to compare two integer values for equality in her java code. Out of (=) and (= =), which operator she
should use and why?
II. Help her in writing Java code to initialize two integer variables named num1 and num2 with values 5 and 10
respectively. Increase the value
of num1 by 5 and decrease the value of num2 by 5.
(b) Mr. Sahil, a programmer in a VISA processing company, has written the following code: 2
int ch=Integer.parseInt(jTextField1.getText());
switch(ch)
{
case 1:
jTextField2.setText(“Short Term Single Entry Visa Granted”);
case 2:
jTextField2.setText(“Short Term Multiple Entry Visa Granted”);
case 3:
jTextField2.setText(“Long Term Single Entry Visa Granted”);
case 4:
jTextField2.setText(“Long Term Multiple Entry Visa Granted”);
default:
jTextField2.setText(“Invalid Entry”);
}
No matter what value is being entered in the text field jTextField1, this program always give a message “Invalid
Entry”. Help Mr. Sahil in identifying the problem and its reason. Also suggest him a suitable correction in the
code.
(c Ms. Meena is not able to understand the statement “Java is a case sensitive language”. Help her in
understanding the above mentioned statement by giving suitable example. 1
(d) Ms. Rachel is designing a frame in Netbeans in which she has used four Radiod Button controls. She want
that only one radio button out of four should be selected at a time. Which property of the Radio Button should be
selected to achieve the same?) 1
(e) What will be displayed in jTextArea1 after the following code is executed: 2
int i;
for(i=10;i<50;i=i+30)
{
i=i+15;
jTextArea1.append(""+i);
}
jTextArea1.append("\n"+i);
(f) The following code has error(s). Rewrite the correct code underlining all the corrections made : 2
while num > 0;
{
remainder assigned = num % 10;
reverse = reverse * 10 + remainder;
num / 10 = num;
}
--------------------------------------------------------------------------

S-ar putea să vă placă și