Page 31 - IP
P. 31

2.    (a)  Ruby, a class XI student has just started learning java programming. Help her in the  4
                   following:
                   i. Explain her the concept of variable and data type by suitable example.
                   ii. Help her in understanding the difference between assignment operator and
                   comparison operator with the help of appropriate example.

                (b) Will the output from the following two code be any different?                          2
                   First Code:
                     int x=2,y=40;
                   while(y<=x) {
                             jTextField1.setText(""+x);
                               x=x+8;
                              }

                    Second Code :
                       int x=2,y=40;
                    do {
                              jTextField1.setText(""+x);
                                     x=x+8;
                                 } while(y<=x);

                      Give reasons for your answer.

                                                          OR
                (b) Predict the output of the following code:
                   int n=4,f=0,i;
                   for(i=1;i<=n;i++)
                   {
                   f=f*i;
                   }
                   jTextField1.setText(""+f);
                   jTextField2.setText(""+i);

                (c)  Dev, a website designer with “Creative Designers Pvt. Ltd.” has written the following  4
                   code. Observe the code given below and answer the following questions:

                   <company>
                       <employee eid=1>
                              <name>Albert</name>
                              <dept deptid=“d1”>Computer</dept>
                       </employee>
                       <employee eid=2>
                              <name>Manisha</name>
                   <dept deptid=“d2”>Accounts</dept>
                       </employee>
                   </company>
                     i. Are these tags part of HTML code or XML code?
                     ii. Identify the root element.
                    iii. Mention any two child elements.
                    iv. Mention any two attributes

                                                            OR


                                                            2
   26   27   28   29   30   31   32   33   34   35   36