Class 12 ISC Board - Computer Science (Java)
Sample Question Paper
OFFICIAL ANSWER KEY & MARKING SCHEME
Part 1 – Answer Key (20 Marks)
Q1. Multiple Choice Questions (10 Marks)
Q# Correct Option Explanation (Brief)
1 (c) integer ‘integer’ is not a Java keyword; ‘int’ is. ‘final’, ‘static’, ‘abstract’ are keywords.
2 (b) false Default value of uninitialized boolean instance variable is false.
3 (b) == ‘==’ checks equality of primitive values; ‘equals’ is a method on objects.
4 (a) Objects Arrays are objects in Java; array variables hold references.
5 (d) internal ‘internal’ is not a Java access modifier (it’s used in C#).
Q2. Short Answer Questions (10 Marks)
(a) Fill in the blanks in the code segment
Code:
int[] arr = {10, 20, 30};
for (int i = 0; i < [Link]; i++) {
[Link](arr[i]);
}
Marks: length (1), i (1)
(b) Find the output
int a = 5;
int b = 10;
[Link](a + b + "Sum"); → 15Sum
[Link]("Sum" + a + b); → Sum510
Part 2 – Solutions & Marking Scheme (50 Marks)
Section A – Logic (Any 2)
Q6. Truth Table Word Problem
Model approach (accept equivalent):
Given: Entry allowed if Admit Card (A) AND (ID (I) OR Fee Receipt (F)).
Expression: E = A · (I + F).
Truth table columns: A, I, F, (I+F), E. Award marks for correct rows and final expression.
Simplification: Already minimal: E = AI + AF.
Q7. K-map Simplification
Expected steps: Plot minterms on 4-variable K-map; form largest possible groups; write minimized
SOP or POS. Award marks for correct groups and final minimal form. (Answers will vary if a
different K-map was given in the question paper.)
Q8. Using Boolean Laws
Example shown in class: F = A + A'B = (A + A') (A + B) = 1·(A + B) = A + B. Award full marks for
any correct sequence of valid laws leading to the minimal form.
Q9. Logic Gate Expression
For a diagram equivalent to F = (A + B)·C: implement OR gate for A, B then AND with C. Award
marks for correct intermediate outputs and final expression.
Q10. Decoder / MUX Implementation
Using 3-to-8 decoder for F(A,B,C) = Σ(1,2,5,7): Connect active-high outputs Y1, Y2, Y5, Y7 to an
OR gate. Award marks for correct mapping of minterms to decoder outputs and final OR realization.
Section B – Programming (Any 2) – Model Code (10 marks each)
Q11. Recursion – Sum of digits
public static int sumDigits(int n) {
if (n == 0) return 0;
return (n % 10) + sumDigits(n / 10);
}
Q12. String – Longest word
String longestWord(String s) {
String[] w = [Link]().split("\\s+");
String ans = "";
for (String t : w) if ([Link]() > [Link]()) ans = t;
return ans;
}
Q13. Arrays – Second largest
int secondLargest(int[] a) {
int max1 = Integer.MIN_VALUE, max2 = Integer.MIN_VALUE;
for (int x : a) {
if (x > max1) { max2 = max1; max1 = x; }
else if (x > max2 && x != max1) { max2 = x; }
}
return max2;
}
Section C – Logic Circuits / Output
Q14. 3-to-8 Decoder – Truth table (active-high)
A (MSB) B C Y0 Y1 Y2 Y3 Y4 Y5 Y6 Y7
0 0 0 1 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0
0 1 1 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0
1 0 1 0 0 0 0 0 1 0 0
1 1 0 0 0 0 0 0 0 1 0
1 1 1 0 0 0 0 0 0 0 1
Realization: Yi = A'B'C' (Y0), A'B'C (Y1), A'BC' (Y2), A'BC (Y3), AB'C' (Y4), AB'C (Y5), ABC' (Y6),
ABC (Y7).
Q15. Half Adder / Full Adder – Key results
Half Adder: Sum = A ⊕ B, Carry = AB.
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
Full Adder: Sum = A ⊕ B ⊕ Cin, Carry = AB + (A ⊕ B)Cin.
Q16. Code Output
Given code prints elements divisible by 4 from {2, 4, 6, 8}.
Expected Output: 4 8