placeholder image to represent content

CS 12 ICSE TEST 3

Quiz by Deepika Upadhyay

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

Correct quiz answers unlock more play!

New Quizalize solo game modes
40 questions
Show answers
  • Q1

    1.             With reference to the program code given below,answer the questions that follow: public static void list(int SNum){

    int[] num = new int[SNum]; num[0] = 0;

    num[1] = 1;

    for (int i = 2; i < SNum; i++) { num[i]= num[i - 1] + num[i - 2];

    }

    for (int i = 0; i < SNum; i++) { System.out.print(num[i] + " ");

    }

    }

    What is the methodlist() performing?

        Finding the factorial

       Reversing a number

     Printing fibonacci series

    Printing Factors of a number

    45s
  • Q2

    int PRO(intn)

    {

    int res = 1;

    while (n % 2 == 0) n = n / 2;

    for (int i = 3; i <= Math.sqrt(n); i++)

    {

    int count = 0, curr_sum= 1; int curr_term = 1;

    while (n % i == 0) { count++;

    n = n / i; curr_term *= i;

    curr_sum += curr_term;

    }

    res *= curr_sum;

    }

    if (n >= 2)

    res *= (1 + n); return res;

    }

    What will the method PRO() return when the value of n=30?

    TRUE

    1

    24

    30

    45s
  • Q3

    int PRO(intn)

    {

    int res = 1;

    while (n % 2 == 0) n = n / 2;

    for (int i = 3; i <= Math.sqrt(n); i++)

    {

    int count = 0, curr_sum= 1; int curr_term = 1;

    while (n % i == 0) { count++;

    n = n / i; curr_term *= i;

    curr_sum += curr_term;

    }

    res *= curr_sum;

    }

    if (n >= 2)

    res *= (1 + n); return res;

    }

    What is the methodPRO() performing?

    Sum of odd factors

    Perfect number

    Sum of even factors

    Sum of primefactors

    30s
  • Q4

     The following program code checks if the positive integer ‘num’ is a perfect number B by returning true or false. There are some places in the code marked as ?1?,?2?, ?3?,?4? and ?5? which are to be replaced by a statement/expression so that the code works properly.

    public int isperfect (int num)

    {

    int sum=?1?;

    {

    for(int i=1;?2?;i++)

    {

    if(?3?==0)

    sum+=i;

    }

    }

    if(sum==?4?)

    return true

    else

     

    }

    return ?5?;

    What is the statementor expression at ?1?

    0

    -1

    10

    2

    30s
  • Q5

    31.  The following program code checks if the positive integer ‘num’ is a perfect number by returning true or false. There are some places in the code marked as ?1?,?2?, ?3?,?4? and ?5? which are to be replaced by a statement/expression so that the code works properly.

    public int isperfect (int num)

    {

    int sum=?1?;

    {

    for(int i=1;?2?;i++)

    {

    if(?3?==0)

    sum+=i;

    }

    }

    if(sum==?4?)

    return true

    else

     

    }

    return ?5?;

    What is the statementor expression at ?2?

    i<n

    i<=n

    i==n

    i*10

    30s
  • Q6

    31.  The  following program code checks if the positive integer ‘num’ is a perfect number by returning true or false. There are some places in the code marked as ?1?,?2?, ?3?,?4? and ?5? which are to be replaced by a statement/expression so that the code works properly.

    public int isperfect (int num)

    {

    int sum=?1?;

    {

    for(int i=1;?2?;i++)

    {

    if(?3?==0)

    sum+=i;

    }

    }

    if(sum==?4?)

    return true

    else

     

    }

    return ?5?;

    What is the statement or expression at ?3?

    num%i

    num

    num/i

    num*i

    30s
  • Q7

    31.  The following program code checks if the positive integer ‘num’ is a perfect number by returning true or false. There are some places in the code marked as ?1?,?2?, ?3?,?4? and ?5? which are to be replaced by a statement/expression so that the code works properly.

    public int isperfect (int num)

    {

    int sum=?1?;

    {

    for(int i=1;?2?;i++)

    {

    if(?3?==0)

    sum+=i;

    }

    }

    if(sum==?4?)

    return true

    else

     

    }

    return ?5?;

    What is the statementor expression at ?4?

    num+i

    num*num

    F

    num

    30s
  • Q8

    31.  The following program code checks if the positive integer ‘num’ is a perfect number by returning true or false. There are some places in the code marked as ?1?,?2?, ?3?,?4? and ?5? which are to be replaced by a statement/expression sot hat the code works properly.

    public int isperfect (int num)

    {

    int sum=?1?;

    {

    for(int i=1;?2?;i++)

    {

    if(?3?==0)

    sum+=i;

    }

    }

    if(sum==?4?)

    return true

    else

     

    }

    return ?5?;

    What is the statementor expression at ?5?

    100

    1

    TRUE

    FALSE

    30s
  • Q9

    With reference to the program code given below, answer the questions that follow:

    public staticint task(int num)

    {

    int n=num;

    int temp=num; intlength = 0; while(n != 0){

    length = length+ 1; n = n/10;

    }

    while(num > 0) {

    rem = num%10;

    sum = sum + Math.pow(rem,len); num = num/10;

    len = len - 1;

    }

    if(sum==temp) return1; else return0;

    }

    What will the method test() return when the value of n=175?

    error

    zero

    1

    true

    30s
  • Q10

    With reference to the program code given below, answer the questions that follow:

    public staticint task(int num)

    {

    int n=num;

    int temp=num; intlength = 0; while(n != 0){

    length = length+ 1; n = n/10;

    }

    while(num > 0) {

    rem = num%10;

    sum = sum + Math.pow(rem,len); num = num/10;

    len = len - 1;

    }

    if(sum==temp) return1; else return0;

    }

    What is the methodtest() performing?

    Armstrong number

    Disarium number

    Perfect number

    Palindrome number

    30s
  • Q11

    Karnaugh map (K-map) technique provides a systematic method for simplifying  

    Multiplexers

    None of these

    Boolean expressions

    Logic gates

    10s
  • Q12

    The output of half adder is in the form of

    carry

    sum

    None of these

    sum and carry

    10s
  • Q13

    K-map for half adder is of variables

    3

    2

    4

    5

    10s
  • Q14

    How many two - input AND and OR gates are required to realize Y = CD + EF + G?

    None of these

    2,3

    3.3

    2,2

    10s
  • Q15

    DeMorgan's first theorem shows the equivalence of

    OR gate and Exclusive OR gate

    NOR gate and Bubbled AND gate.

    NA N D gate and NOT gate

    NOR gate and NAND gate.

    10s

Teachers give this quiz to your class