Search This Blog

Saturday, December 25, 2010

Board questions : OUTPUT BASED 2 marks

class boards
{
    void outputbasedquestions()
    {
        int x=5;
        System.out.println(5*++x);  //ICSE 2005
        x=5;
        System.out.println(5*x++);  //ICSE 2005
       
        int m=5;
        int n=2;
        m-=n;
        System.out.println("m is = " +m);
        m=5;
       n=2;
        n=m+m/n;
        System.out.println("n is =" +n);
       
        int a=0, b=30, c=40;
        a=--b+c+ ++b;                    //ICSE 2006
        System.out.println("a = " +a);
       
       
        int val=500;
        int sum;
        n=550;
        sum=n+val>1750?400:200;    //ICSE 2006
        System.out.println("sum is =" +sum);
       
        val=1600;
        sum=n+val>1750?400:200;   //ICSE 2006
        System.out.println("sum is =" +sum);
       
        System.out.println("four:" +4+2);   // ICSE 2007
        System.out.println("four:" +(2+2)); //ICSE 2007
       
       
        a=2;
        b=3;
        c=9;
        int out=a-(b++)*(--c);                //ICSE 2007
        System.out.println("OUTPUT:"  +out); 
       
        a=2;
        b=3;
        c=9;
        out=a*(++b)%c;                         //ICSE 2007
        System.out.println("OUTPUT:"  +out);
       
               
    }
    void morequestions()
    {
        double x=-9.99;
        System.out.println(Math.abs(x));     //ICSE 2008
       
        x=9.0;
        System.out.println(Math.sqrt(x));    //ICSE 2008
       
       
       
    }
   
   
}


OUTPUT ON THE TERMINAL WINDOW:

30
25
m is = 3
n is =7
a = 99
sum is =200
sum is =400
four:42
four:4
OUTPUT:-22
OUTPUT:8

9.99
3.0

7 comments:

  1. thanks.. was a grt help :)

    ReplyDelete
  2. The third answer is wrong...i executed the snippet on the computer. The answer is a=98.

    ReplyDelete
  3. The ICSE board is one of the most popular boards in India and students who belong to the Icse board are very lucky. Because of the covid crisis, many students have been not concentrated on their studies, and Now they are worried about their exam then don't fear because Ziyyara is here for Helping You.
    Visit On:- icse online tuition
    Phone no - +91-9654271931

    ReplyDelete