Skip to content

Question bank

Every question, by chapter, year, marks and type.

58 questions

  • Practice question

    3 marks

    Write a Java program segment to count the words in a sentence s that has single spaces between words.

    Class 12 Computer ScienceString HandlingMediumApplication based

  • Practice question

    3 marks

    How many elements are there in a two-dimensional array declared as int a[5][4], and how much memory does it occupy if an int takes 4 bytes?

    Class 12 Computer ScienceArraysMediumNumerical

  • Practice question

    3 marks

    Name three applications of a stack.

    Class 12 Computer ScienceStacksMediumShort answer

  • Practice question

    3 marks

    State the worst-case number of comparisons made by bubble sort on an array of n elements.

    Class 12 Computer ScienceArraysMediumNumerical

  • Practice question

    3 marks

    State three differences between the String and the StringBuffer classes.

    Class 12 Computer ScienceString HandlingMediumShort answer

  • Practice question

    3 marks

    Write a Java program segment to search for a value v in a sorted array a of size n using binary search.

    Class 12 Computer ScienceArraysMediumApplication based

  • Practice question

    3 marks

    Write a recursive Java method to reverse a string.

    Class 12 Computer ScienceRecursionMediumApplication based

  • Practice question

    3 marks

    Distinguish between an encoder, a decoder and a multiplexer.

    Class 12 Computer ScienceCombinational and Sequential Logic CircuitsMediumShort answer

  • Practice question

    3 marks

    A class B extends class A, and both define a method show(). If A a = new B(); a.show(); is executed, which version runs and why?

    Class 12 Computer ScienceInheritance and PolymorphismMediumNumerical

  • Practice question

    3 marks

    Why are constants and lower-order terms dropped from a big O expression?

    Class 12 Computer ScienceComplexity and Big O NotationMediumShort answer

  • Practice question

    3 marks

    What does the super keyword do in Java?

    Class 12 Computer ScienceInheritance and PolymorphismMediumShort answer

  • Practice question

    3 marks

    Write a Java program segment to count the number of vowels in a given string s.

    Class 12 Computer ScienceString HandlingMediumApplication based

  • Practice question

    3 marks

    State the time complexity of the following and justify it: for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) sum++;

    Class 12 Computer ScienceComplexity and Big O NotationMediumNumerical

  • Practice question

    3 marks

    Reduce F(A, B, C, D) = Σ(0, 2, 8, 10) using a Karnaugh map.

    Class 12 Computer ScienceKarnaugh MapsMediumNumerical

  • Practice question

    3 marks

    Write a recursive Java method to find the greatest common divisor of two positive integers.

    Class 12 Computer ScienceRecursionMediumApplication based

  • Practice question

    3 marks

    What is a circular queue and what problem does it solve?

    Class 12 Computer ScienceQueuesMediumShort answer

  • Practice question

    3 marks

    State and verify the absorption law X + X·Y = X using a truth table.

    Class 12 Computer ScienceBoolean AlgebraMediumStructured

  • Practice question

    3 marks

    What is the output of: String s = "Programming"; System.out.println(s.indexOf('g') + " " + s.lastIndexOf('g') + " " + s.replace('g', 'G'));

    Class 12 Computer ScienceString HandlingMediumNumerical

  • Practice question

    3 marks

    State the rules for forming groups on a Karnaugh map.

    Class 12 Computer ScienceKarnaugh MapsMediumShort answer

  • Practice question

    3 marks

    A stack of capacity 5 is empty. After push(1), push(2), push(3), pop(), push(4), pop(), pop(), what is left on the stack?

    Class 12 Computer ScienceStacksMediumNumerical