Home works and Assignments Online

Home » Class XI » Information Practices XI

Information Practices XI

1. What is the difference between entry controlled and exit controlled loops?

2. Write four characteristics of Java programming language?

3. Write the result of the following java expressions:

int a=4, b=3, c=5, d=6;

a) System.out.print(“” + ((a>b)?d:c));

b) System.out.print(“” + ((a>b)||(c<d)&&(d>a)||(c>b)));

c) System.out.print(“” + ((++a)+b*a+(c++)*(–d)));

d) System.out.print(“” + ((a|b)&(c|d)));

4. Differentiate setText() and getText() methods using examples.

5. What is the importance of comments in a program? How many types of comments do java programming language support?

6. Rewrite the following code using if.. else construct

int num = Integer.parseInt(tf1.getText());

switch (num)

{

case 2:

case 4:

case 6:

case 8:

case 10:

System.out.println(“Even Number”);

break;

case 3:

case 5:

case 7:

System.out.println(“Prime Number”);

break;

Default:

System.out.println(“Not a valid number”);

break;

}

7. Paradise Park uses the following interface to generate bill for its customers.

clip_image001

When the bill button is clicked the bill is displayed as shown in the interface above. The functionality is as follows:

Rate for joy ride 1 is 100 and that for Joy ride 2 is 200. A customer can select one or both the joy rides. The total is calculated as the sum of one or both joy rides cost. A discount of Rs 50 is given on total if the child is below 12 years.

Write code under the action event of the jButton to achieve the above functionality.

8. Convert the following code segment using switch-case construct:

int num = Integer.parseInt(txtNum.getText());

if(num>=2 && num<=5)

txtRes.setText(“Prime”);

else if(num==6 || num==8 || num==10)

txtRes.setText(“Even”);

else

txtRes.setText(“Not Valid”);

9. Predict the output of the following java construct:

int m=5;

int prod=1;

int i=1;

while(i<=5)

{

prod=prod+prod*(m%2);

–m;

++i;

}

System.out.println(“”+prod);

 

Date of submission: 3 Nov. 2015

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: