KnowledgeBoat Logo

Output Questions for Class 10 ICSE Computer Applications

  • User Defined Methods

    Give output of the following method definition and also write the mathematical operation they carry out:

    
    void test2(int a, int b)
    {
        while( a != b)
        {
          if ( a > b)
            a = a — b;
          else
            a = b — a;  
        }
        System.out.println(a);
    }
    

    if 4 and 17 are passed to the function.

    View Answer

    128 Likes


  • Java Nested for Loops

    Give the output of the following Java program snippet based on nested loops:

    int y,p;
    for (int x=1; x<=3; x++)
    {
    for (y=1; y<=2; y++)
    {
    p = x * y;
    System.out.print(p);
    }
    System.out.println( );
    }
    
    View Answer

    114 Likes


  • Java Nested for Loops

    Give the output of the following Java program snippet based on nested loops:

    int x,y; 
    for(x=1; x<=5; x++)
    {
    for(y=1; y<x; y++)
    {
    if(x == 4)
        break; 
        System.out.print(y);
    }
    System.out.println( );
    }
    
    View Answer

    99 Likes


  • Java Nested for Loops

    Give the output of the following Java program snippet based on nested loops:

    int a,b; 
    for (a=1; a<=2; a++)
    {
    for (b= (64+a); b<=70; b++) 
    System.out.print((char) b); 
    System.out.println( );
    }
    
    View Answer

    84 Likes


  • Java Nested for Loops

    Give the output of the following Java program snippet based on nested loops:

    int i,j;
    first:
    for (i=10; i>=5; i--)
    {
    for (j= 5; j<=i; j++)
    {
    if (i*j <40)
        continue first; 
    System.out.print(j);
    }
    System.out.println( );
    }
    
    View Answer

    78 Likes


  • Java Nested for Loops

    Give the output of the following Java program snippet based on nested loops:

    int i,j;
    for (i=0; i<4; i++)
    {
    for (j=i; j>=0; j--) 
    System.out.print(j); 
    System.out.println();
    }
    
    View Answer

    92 Likes


  • Java Conditional Stmts

    Predict the output of the following Java program code snippet:

    int m=3,n=5,p=4;
    if(m==n && n!=p)
    {
    System.out.println(m*n);
    System.out.println(n%p);
    }
    if((m!=n) || (n==p))
    {
    System.out.println(m+n);
    System.out.println(m-n);
    }
    
    View Answer

    79 Likes


  • Java Conditional Stmts

    Predict the output of the following Java program code snippet:

    int a=1,b=2,c=3;
    switch(p)
    {
    case 1: a++;
    case 2: ++b;
    break;
    case 3: c--;
    }
    System.out.println(a + ","
    + b + "," +c);
    
    View Answer

    85 Likes


  • Java Conditional Stmts

    Predict the Output of the given snippet, when executed:

    int a=1,b=1,m=10,n=5; 
    if((a==1)&&(b==0))
    {
    System.out.println((m+n)); 
    System.out.println((m—n));
    }
    if((a==1)&&(b==1))
    {
    System.out.println((m*n)); 
    System. out.println((m%n));
    }
    
    View Answer

    87 Likes


  • Java Conditional Stmts

    Predict the Output of the given snippet, when executed:

    int b=3,k,r;
    float a=15.15,c=0;
    if(k==1)
    {
    r=(int)a/b;
    System.out.println(r);
    }
    else
    {
    c=a/b; 
    System.out.println(c);
    }
    
    View Answer

    89 Likes


Showing 11 - 20 of 147 Questions