placeholder image to represent content

Computer Science ISC 12th - paper 2

Quiz by Sujatha Rajkumar

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
33 questions
Show answers
  • Q1

    1.  Given the Boolean expression F = ( P + R) · ( P·Q + Q·R’ ),identify

    (a) the complement of the expression [2]

    (ii) (P’+R’) . (P’+Q’) + (Q+R’)

    (iv) (P+R)’ .(P’+Q).(Q’+R)

    (iii) P’R’ .(PQ’ + Q’R)

    (i) P’R’ + (P’+Q’).(Q’+R)

    45s
  • Q2

    2.  26Thefollowing public method is a part of some class, Assume that both theparameters x and y are positive integers. Answer the questions following it

    intAfunction(int x, int y) 

    {

    intp=1,n=x;

    while(y>0)

    {

    if(y%2==1)

    P*=n;

    y/=2

    n*=n;

    }

    returnp;

    }

    What will be returned by Afunction(2,7) [2]

    ii.  128

    iv. None

    i. 256

    iii. 64

    120s
  • Q3

    3.   The following public method is a part of some class, Assume that both the parameters x and y are positive integers. Answer the questions following it

    int A function (int x, int y)

    {

    intp=1,n=x;

    while(y>0)

    {

    if(y%2==1)

    P*=n;

    y/=2

    n*=n;

    }

    returnp;

    }

    State that what is being done by Afunction(int,int) in general [1]

    (iv) finding product of x and y

    (i) finding sum of x and y

    (ii )finding x raised to y

    (iii) finding y raised to x

    120s
  • Q4

    4.  withreference to the code given below answer the questions that follow

    voidshow(int n, int d)

    {

    While(n>1)

    {

    if(n%d==0)

    {

    System.out.print(“\t”+d);

    n=n/d;

    }

    else

    d++;

    }

    }

    What is the output of function show (24,2)  [2]

    (iii)3 4 7

    (ii)2 2 3 2

    (iv)2 2 3 2

    (i)2 2 2 3

    120s
  • Q5

    5.  withreference to the code given below answer the questions that follow

    voidshow(int n, int d)

    {

    While(n>1)

    {

    if(n%d==0)

    {

    System.out.print(“\t”+d);

    n=n/d;

    }

    else

    d++;

    }

    }

    State what is being computed by show(x,y)                                                [1]

    iv. none

    (ii) Finding prime factors of n

    i.  finding prime factors of n

    iii. finding multiples of n

    120s
  • Q6

    6.  withreference to the program code given below

    voiddimen(int n[][])

    {

    intt=0;

    for(inti=0;i<n.length;i++)

    {

    for(intj=0;j<n[0].length;j++)

    {

    if(i==j)

    t=t+n[i][j];

    }

    }

    System.out.println(t)

    }

    What will be the output of the method dimen() when the value of                                 [2]

    n[][]={{1,2,3},{3,4,5},{6,7,8}}

    iii. 13

    i. 44

    ii. 20

    (iv)-13

    120s
  • Q7

    7.   withreference to the program code given below

    voiddimen(int n[][])

    {

    intt=0;

    for(inti=0;i<n.length;i++)

    {

    for(intj=0;j<n[0].length;j++)

    {

    if(i==j)

    t=t+n[i][j];

    }

    }

    System.out.println(t)

    }

    What is the method dimen() performing                                                                             [1]

    i.  Finding sum of non-boundary elements

    iv.   Finding sum of non diagonal elements

    ii. Find sum of boundary elements

    (iii)- Finding sum of diagonal elements

    120s
  • Q8

    8. with reference to the program code given below ,answer the questions that follow

    voidsolve(int x[])

    {

    intsum=0;

    for(inti=0;i<x.length;i++)

    {

    sum=sum+(x[i]*x[i]);

    }

    System.out.println(sum);

    }

    }

     What will be the output of the method solve()when the value of

    x[]={1,2,3,4,5}                                                                                                                                                  [2]

    i. 40

    (ii)-55

    iv. 60

    iii. 30

    120s
  • Q9

    9.  with  reference to the program code given below ,answer the questions that follow

    voidsolve(int x[])

    {

    intsum=0;

    for(inti=0;i<x.length;i++)

    {

    sum=sum+(x[i]*x[i]);

    }

    System.out.println(sum);

    }

    }

    what is the method solve() performing                                                                                          [1]

    ii. sum of the odd elements

    i. sum of the elements

    (iii) sum of the squares of the elements

    iv. sum of the even elements

    120s
  • Q10

    10.   With reference tothe program code below , Answer the question that follows

    intdec=0, c=0;

    intperform(long n)

    {

    while(n>0)

    {

    intd=(int)n%10;

    dec=dec+d*(int)Math.pow(2,c++);

    n=n/10;

    }

    returndec;

    }

    What will be returned by the method perform(1110)                                                           [2]

    i.  12

    iv.  1

    iii.  15

    ii-14

    120s
  • Q11

    11.  .With reference to the program code below , Answer the question that follows

    int dec=0, c=0;

    int perform(long n)

    {

    while(n>0)

    {

    intd=(int)n%10;

    dec=dec+d*(int)Math.pow(2,c++);

    n=n/10;

    }

    return  dec;

    }

    What is the method perform() doing                                                                              [1]

    (i)finding octal equivalent

    (ii) decimal equivalent

    (iv)finding binary equivalent

    (iii)finding hexadecimal equivalent

    120s
  • Q12

    12.   The following function is a part of some class which computes and returns the greatest common divisor of any two numbers. There are some places inthe code marked by ?1?, ?2?, ?3?, ?4? and ?5? which must be replaced by statement/expression so that the function works correctly0

    intgcd(int a, int b)

    {

    intr.

    while(?1?)

    {

    r= ?2?;

    b= ?3?;

    a= ?4?

    }

    if(a ==0)

    return?5?;

    else

    return-1;

    }

    What is the expression or statement at ?1?                                                                          [1]

    ii.  b

      iv. none

     iii. r!=0

    i)a!=0

    120s
  • Q13

    13.   The following function is a part of some class which computes and returns the greatest common divisor of any two numbers. There are some places in the code marked by ?1?, ?2?, ?3?, ?4? and ?5? which must be replaced by statement/expression so that the function works correctly0

    intgcd(int a, int b)

    {

    intr.

    while(?1?)

    {

    r= ?2?;

    b= ?3?;

    a= ?4?

    }

    if(a ==0)

    return?5?;

    else

    return-1;

    }

    What is the expression or statement at ?2?                                                                              [1]

    (iii)-(b %a)

    i. a

    iv. r

    ii. b

    120s
  • Q14

    14.  The following function is a part of some class which computes and returns the greatest common divisor of any two numbers. There are some places in the code marked by ?1?, ?2?, ?3?, ?4? and ?5? which must be replaced by statement/expression so that the function works correctly0

    intgcd(int a, int b)

    {

    intr.

    while(?1?)

    {

    r= ?2?;

    b= ?3?;

    a= ?4?

    }

    if(a ==0)

    return?5?;

    else

    return-1;

    }

    What is the expression or statement at ?3?                                                                    [1]

    (iv) a %b

    (I)a* b! = 0

    (III)- a

    (ii) b

    120s
  • Q15

    15.  With reference to the program code below , Answer the question that follows

    intdec=0, c=0;

    intperform(long n)

    {

    while(n>0)

    {

    intd=(int)n%10;

    dec=dec+d*(int)Math.pow(2,c++);

    n=n/10;

    }

    return dec;

    }

    What is the expression or statement at ?4?                                                                            [1]

    (iv)r

    i)a * b! = 0

    (ii) b

    (iii) a

    120s

Teachers give this quiz to your class