XIIC-IP MAY 2013 ASSIGNMENT/HOME WORK for Summer Vacation


XIIC-IP MAY 2013 ASSIGNMENT/HOME WORK for Summer Vacation                 

1.Rewrite the following code fragment using do-while loop and also give output :  
            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?
        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:
           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:

          jTextArea1.setText("Object\nOriented\tProgramming\n In Java");

    5. Rewrite the following program code using switch statement:
          int d; String day;
          if (d == 1)
          day = "Monday";
           else if (d == 2)
           day = "Tuesday";
           else if (d == 3)
           day = "Wednesday";
           else            day = "-";

6. The following code has some error(s). Rewrite the correct code underlining all the corrections made:

        int i=2; j=5
        while j>i
        {jTextField1.gettext("j is greater");
          j--;++i;}
         joptionPane.ShowMessageDialog("Hello");

(Hint: Refer  FINAL_INFORMATICS_PRACTICES_CLASS_XI.pdf   page no.137   Figure 6.2  Code for the Vote Eligibility Checker Application)
8. Rewrite the following code using While LOOP 
         i=2;
        do
      {
         System.out.println(i);
          i+=2;
       } while(i<50);

9.  Find the output of the following code if ch=’B’ 

  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’);
    }
10.The following code has some error(s). Rewrite the correct code underlining all the corrections made.

     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;
    }

11.The following code has some error(s). Rewrite the correct code underlining all the corrections made:               int a, b=20;                                                                
       DO      {    a=b*2;
             b=a/b;
       }While(b>40)
12.What will be the output of the following code fragment if the value of ch is ‘a’                
      switch(ch) { case ‘a’ : System.out.println(“it is a.”);
       case ‘b’ : System.out.println(“it is b.”);
       case ‘c’ : System.out.println(“it is c.”);
        break;
        case ‘d’ : System.out.println(“it is d.”);
         break;
         default  : System.out.println(“not a b c d.”);
         }
    13.Write the output of the following code                                                                           
     int j = 10,x=0,i=0;
     for (i = 1;i<=10;i++)
   {
      if(i%2==0)
      x = x+ (i * j);
       j = j – 2 ;
   }
     System.out.println(x);
14. Rewrite the folowing code to for loop                                                                                                
       int f=1,I=2 ;
       while(++I <5)
            f*=I ;
       System.out.println(f);

15.Rewrite the code after making correction. Underline the corrections.               
        int sum; value ; inct;
        int i;
        for (i==0,i<=10; i++)
         sum+= I;
        inct ++;
16.What will be the output of the following code                                                                                   
       int I = 3 , n =0 ;
       while ( I < 4)
       {    n++ ; I -- ;
        }
        System.out.println( n );
17.Convert the following segment into an equivalent do loop.                                     
      int x, c;
      for (x=10, c=20; c>=10; c=c-2)
      x++;
18.What will be the output of following segment?                                                                      
  int i, j, k, x=0;
  for (i=0; i<5; ++i)
            for (j=0; j<i; ++j)
            {
                        k=(i+j-1);
                        if (k%2==0)
                                    x+=k;
                        else
                                    if (k%3==0)
                                    x+=k-2;
                        System.out.print(x+” ”);
             }
            System.out.println(“\n”+x);
 }

19.       What is “Numeric Data Type “ in Java ? Give their Name, Size, Range, Values ,Example.What is their default values.

20.Write a short note on the following topics :
     a. Variable Naming Conventions in Java
        b.  Logical Operators in Java (List of Operators, Use and Meaning)

                                       PROJECTS/CASE STUDIES for Summer Vacation

Go through Chapter-11 Sample Applications -
Case Studies and implement the following Projects in Java NetBeans IDE and submit a softcopy of these 3 Projects(Case Studies)
Case Study 1 - Cross N Knot Game
Case Study 2 - Salary Calculator
Case Study 3 - Restaurant Billing System
(Hint: Refer  FINAL_INFORMATICS_PRACTICES_CLASS_XI.pdf   page no.285 to 348
Understand the Problem and the code/logic….You may directly Copy and paste the given codes in NetBeans IDE to save the typing efforts)

Complete your NoteBooks and isure that it contains the following:
1.A Detailed Note on Revision of JAVA PROGRAMMING Taught in XI
2.Include all the points discussed during April-May 2013 class room transactions
(Flow of Control, Conversion between if-else and switch , for loop and do loop, do loop and while loop  and vice versa)

NOTE--Submit the above works/asiignments/projects latest by 24th June 2013. Feel free to mail me at hsyadav.kvs@gmail.com for any queries/doubts.

Popular posts from this blog

XII- CS-- SOLVED SQL queries (SQL PRACTICAL ASSIGNMENS)

SQL--HOME ASSIGNMENTS(XII Class)

Python-MySQL Connectivity