Practice TestsISCClass 12Computer Science

ISC Class 12 Computer Science MCQ Practice Tests (Boolean Algebra & Java)

Five ISC Class 12 Computer Science MCQ practice tests on Boolean algebra, propositional logic, hardware, K-maps, array address calculation and Java output questions, two of them with answer keys. Free PDF download with solved examples.

8 min read
ISC Class 12 Computer Science MCQ Practice Tests (Boolean Algebra & Java)

Objective questions test whether you really understand a concept, not just whether you remember a program. These five ISC Class 12 Computer Science MCQ tests cover the topics that appear in Part I of the theory paper and decide many Section A answers.

Tests included

  1. Class XII Test (70 marks, 1½ hours): each question is tagged by topic: Boolean algebra (including which expression is not equivalent to P ⇔ Q), computer hardware (gates and circuits), methods, arrays, and variables and expressions.
  2. Boolean Algebra MCQ Test: laws, duals, minterms, complements and simplification.
  3. First Semester Paper 1 (with answers): Boolean algebra MCQs with the correct option and answer given for each question.
  4. Sample Paper 1 (35 marks, 40 minutes, with answer key): duals, evaluation, maxterms and K-map questions, with an option-wise answer key at the end.
  5. Java MCQ Test: array address calculation in row-major and column-major order, and Java output prediction.

Solved examples

Q1. Which law does A + A' = 1 represent?

The complementarity (complement) law: a variable ORed with its complement is always 1. The dual of this law is A · A' = 0.

Q2. A matrix A[m][m] is stored in column-major order with 4 bytes per element. The address of A[1][1] is 1500 and the address of A[4][5] is 1608. Find m.

In column-major order:

Address = B + W × [(J − Lc) × M + (I − Lr)]
1608    = 1500 + 4 × [(5 − 1) × m + (4 − 1)]
108     = 4 × (4m + 3)
27      = 4m + 3
m       = 6

The matrix is of order 6 × 6.

Q3. Is AB + AC equivalent to AB + AC + BC?

Not in general. The consensus theorem says AB + A'C + BC = AB + A'C, but that needs a complemented A in the second term. Here, with A = 0, B = 1, C = 1, the left side gives 0 while the right side gives 1, so the two are not equivalent. Always test a suspected identity with a few input values before choosing an option.

How to use these tests

  • Take Tests 1–4 one at a time, each in a single sitting, and score yourself with the answer keys where they are given.
  • Use the Java MCQ test after revising arrays. Address calculation questions are quick marks if you remember the formula.
  • Note every law you got wrong and write its dual next to it. Pairs are easier to remember.

For a full paper in the current format, try our solved ISC Class 12 Computer Science Sample Paper 2027.

Download the papers

ISC Class 12 Test (70 marks)

PDF · 195 KB

Download PDF

ISC Class 12 Boolean Algebra MCQ Test

PDF · 90 KB

Download PDF

ISC Class 12 First Semester Paper 1 (with answers)

PDF · 260 KB

Download PDF

ISC Class 12 Sample Paper 1 (with answer key)

PDF · 338 KB

Download PDF

ISC Class 12 Java MCQ Test

PDF · 419 KB

Download PDF
Read the questions as text
ISC Class 12 Test (70 marks) CLASS : XII SUBJECT: COMPUTER SCIENCE Answer all the Questions MAX MARKS : 70 DURATION : 1 ½ HRS Question 1: [Boolean Algebra] (1) Which one of the following is not equivalent to P⬄Q 1. (~P V Q) ∧ (P V ~Q) 2. (~PVQ) ∧ (q =>P) 3. (~P∧Q) V (P∧~Q) 4. (~P∧~Q) V (P∧Q) Question 2: [Boolean Algebra] (1) The Boolean function AB + AC is equivalent to ________. 1. AB + AC + BC 2. A’B’C’ + ABC’ + A’BC 3. ABC + A’BC + B’C’ 4. ABC + ABC’ + AB’C Question 3: [Computer Hardware] (1) Logic gates required to build up a half adder circuit are: 1. EXOR gate and NOR gate 2. EXOR gate and OR gate 3. EXOR gate and AND gate 4. EXOR gate and NAND gate Question 4: [Boolean Algebra] (2) Consider the Boolean function F = (a + bc) . (pq + r). Find F’: 1. (a’+ b’c’) . (p’q’ + r’) 2. a’(b’ + c’) + (p’ + q’) r’ 3. (a’ + b’c’) + (p’q’ + r’) 4. (a’b’c’) + (p’q’r’) Question 5: [Boolean Algebra] (1) Which of the following is a tautology? 1. x 2. (x + x’)y 3. x + y’ + x’ 4. (xy) + x’ Question 6: [Computer Hardware] (1) The total number of binary function that can be defined using n boolean variable is ____. 1. 2n – 1 2. 2n 3. 2n+1 4. None Question 7: [Statements, Structures and Scope] (2) Determine the output of the below code: 1. 2 3 4 2. 2 4 5 3. 2 5 4 4. 2 4 3 Question 8: [Statements, Structures and Scope] (2) Write the output of the statement given: System.out.println(‘A’+ ‘1’ + ‘C’); 1. 65+1+66 2. 10+1+67 3. 181 4. 65+49+67 Question 9: [Boolean Algebra] (2) The proposition (A V B) V (A →B) is a: 1. Contradiction 2. Contingency 3. Tautology 4. Implication Question 10: [Arrays] (2) A square matrix M[] [] of size 10 is stored in the memory with each element requiring 4 bytes of storage. If the base address at M[0][0] is 1840, determine the address at M[4][8] when the matrix is stored in Row Major Wise. 1. 2031 2. 2032 3. 2033 4. 2034 Question 11: [Boolean Algebra] Reduce the given Boolean Function F(P, Q, R, S) = π (0, 1, 3, 5, 7, 8, 9, 10, 11, 14, 15) by using 4-variable Karnaugh map and answer the following questions: a) What will be the least number of groups and their types formed for reduction? (1) 1. 2 Quads 2. 2 Quads and 2 pairs 3. 3 Quads 4. 3 Quads and 2 pairs b) The reduced expression of the Boolean function given above is: (2) 1. (P’ + S) (P’ + R’) (Q + R) 2. (P + S) (P + R) (Q’ + R’) 3. (P + S’) (P’ + R’) (Q + R) 4. None of the above Question 12: [Boolean Algebra] Reduce the given Boolean Function F(A, B, C, D) = π (0, 2, 6, 8, 10, 14) by using 4-variable Karnaugh map and answer the following questions: a) What will be the least number of groups and their types formed for reduction? (1) 1. 2 Quads 2. 2 Quads and 2 pairs 3. 3 Quads 4. None of the above b) The reduced expression of the Boolean function given above is: (2) 1. (A + B) (C’ + D) 2. (B + D) (C’ + D) 3. (B’ + D’) (C’ + D’) 4 (B + D’) ( C + D’) Question 13: [Boolean Algebra] A Government Institution intends to award a medal to a person who qualifies any one of the following criteria: The person should have been an Indian citizen and had lost his/her life in a war but had not completed 25 years of service. OR The person must be an Indian citizen and had served the nation for a continuous period of 25 years or more but has not lost his/her life in a war. OR The person is not an Indian citizen but has taken active part in activities for the upliftment of the nation. The inputs are: A The Person is/was an Indian citizen B Has a continuous service of more than 25 years C Lost his/her life in a war D Taken part in activities for upliftment of the nation Output: X – Denotes eligible for medal [ 1 indicates YES and 0 indicates NO in all cases ] Draw the truth table for the inputs and outputs given above and answer the following questions a) The POS expression for X(A,B, C, D) will be: (2) 1. F(A, B, C, D) = Σ (0, 2, 4 , 6, 8, 9, 14, 15) 2. F(A, B, C, D) = π (0, 2, 3, 5, 8, 10, 13, 14, 15) 3. F(A, B, C, D) = Σ (0, 1, 2, 3, 6, 8, 9, 11, 13, 14, 15) 4. None of the Above b) The maximum input combinations for the above truth table will be: (1) 1. 24 2. 16 3. 8 4. 4 Question 14: [Boolean Algebra] (1) The dual of the Boolean equation (~P . Q) + (R’ + S’) = 0 . 1 1. (~P . Q) . (R’ . S’) = 0 + 1 2. (~P + Q) + (R’ + S’) = 1 + 0 3. (~P + Q) . (R’ . S’) = 1 + 0 4. (~P + Q) + (R’ . S’) = 1 + 1 Question 15: [Boolean Algebra] (1) If A=1, B=0, C=0, D=1, then the minterm will be: 1. A’BCD’ 2. AB’C’D 3. A’+B+C+D’ 4. A+B’+C’+D Question 16: [Computer Hardware] From the logic circuit diagram given below, name the outputs (1), (2) and (3). Finally simplify it to show that it represents a logic gate. a) Identify the Output (1) (1) 1. XY 2. X+Y 3. XY’ 4. X+Y’ b) Identify the Output (2) (1) 1. XZ 2. XZ’ 3. X+Z 4. X’+Z’ c) Identify the Output (3) (1) 1. (XY). XZ 2. (X’Y’) X+Z 3. (X+Y’). XZ 4. (XY’) + XZ d) Simplify the given expression: (X+Y’) . XZ + Z’ (2) 1. XZ’ 2. X+Z’ 3. X’+Z 4. X’+Z’ Question 17: [Methods] (2) The following function Check() is a part of some class. What will the function Check() return when the values of both m and n are equal to 5? Identify the Output. int Check(int m, int n) { if(n==1) return – m--; else return ++m + Check(m, --n); } 1. 21 2. 22 3. 23 4. 24 Question 18: [Methods] The following function is a part of the class ITEM which stores n integers in an array arr[]. The member function/method sort() arranges the array in ascending order. There are five places in the code marked by ?1?, ?2?, ?3?, ?4?, ?5? that must be replaced by expressions or statements. void sort() { int s; int a= n – 1; do { s=0; for(int i=0; i< ?1? ; i++) { if (?2? > arr[i + 1]) { int val = arr[i]; arr[i] = ?3?; arr[i+1]= val; s=1; } } a=?4? ; } while (s = = ?5?) ; } a) What is the statement or expression at ?1? (1) 1. s 2. n 3. i < a 4. 5 b) What is the statement or expression at ?2? (1) 1. arr[i] 2. n 3. s 4. a c) What is the statement or expression at ?3? (1) 1. val 2. arr[i+1] 3. 0 4. a d) What is the statement or expression at ?4? (1) 1. a - 1 2. i – 1 3. i + 1 4. val + 1 e) What is the statement or expression at ?5? (1) 1. 0 2. 10 3. arr[i] 4. 1 Question 19: [Methods] The following is a function of some class. It returns 1 if the number is a perfect number otherwise it returns 0. A perfect number is a number which is equal to the sum of its factors other than the number itself. int perfectno (int n) { int ?1? ; for (int j=1; ?2?; j++) { if (?3?) sum ?4? ; } if (?5?) return 1; else return 0; } a) What is the statement or expression at ?1? (1) 1. sum=0 2. j=0 3. n 4. None of the above b) What is the statement or expression at ?2? (1) 1. j<10 2. s>j 3. j<n 4. j<s c) What is the statement or expression at ?3? (1) 1. s==n 2. s>j 3. s==j 4. n%j==0 d) What is the statement or expression at ?4? (1) 1. sum=sum+1 2. sum=sum+j 3. sum=j 4. sum=j+1 e) What is the statement or expression at ?5? (1) 1. j==1 2. j==sum 3. sum==n 4. 1==sum Question 20: (2) What is the output of the code given below? class Demo { public static void main(String[] args) { final int a = 10, b = 20; while (a > b) { System.out.println("Hello"); } System.out.println("World"); } } 1. Hello 2. World 3. Compile Error 4. False Question 21: [Boolean Algebra] (2) The reduced expression for the Boolean function F (A, B, C, D) = Σ(7, 11, 13, 14, 15) is: 1. BCD . ABD . ABC . ACD 2. BCD + ABD + ABC + ACD 3. BCD + A’B’D + ABC’ + AC’D 4. BCD . A’B’D . ABC’ . AC’D Question 22: [Boolean Algebra] If A= “I’m hiking the Grand Canyon” and B= “I’m in Arizona”, then write the proposition for: a) The Converse of the proposition is: (1) 1. If I’m not in Arizona, then I’m not hiking Grand Canyon. 2. If I’m in Arizona, then I’m hiking the Grand Canyon. 3. If I’m not hiking the Grand Canyon, then I’m not in Arizona. 4. If I’m hiking the Grand Canyon, then I’m in Arizona. b) The Contrapositive of the proposition is: (1) 1. If I’m not in Arizona, then I’m not hiking the Grand Canyon. 2. If I’m in Arizona, then I’m hiking the Grand Canyon. 3. If I’m not hiking the Grand Canyon, then I’m not in Arizona. 4. If I’m hiking the Grand Canyon, then I’m in Arizona. c) The Inverse of the proposition is: (1) 1. If I’m not in Arizona, then I’m not hiking the Grand Canyon. 2. If I’m in Arizona, then I’m hiking the Grand Canyon. 3. If I’m not hiking the Grand Canyon, then I’m not in Arizona. 4. If I’m hiking the Grand Canyon, then I’m in Arizona. Question 23: [Boolean Algebra] (1) The law which represents Boolean equation P + P’Q = P + Q is: 1. Absorption law 2. Distributive law 3. Commutative law 4. Idempotence law Question 24: : [Statements, Structures and Scope] (1) Identify the scope of protected access specifier. 1. class, subclass 2. class 3. Accessible everywhere 4. None of the above Question 25: [Variables and Expressions] (1) Which of the statement is not the correct declaration? 1. for (int i=99; i>=0; i/9) 2. for (int i=7; i<=77; i+=7) 3. for (int i=20; i>=2; i--) 4. for(int i=2; i<=20; i=2*i) Question 26: [Statements, Scope] (1) Which of these jump statements can skip processing the remainder of the code in its body for a particular iteration? 1. break 2. return 3. exit 4. continue Question 27: [Statements, Scope] (1) Identify the incorrect statement? 1. switch statement only test for equality, whereas if statement can evaluate any type of boolean expression 2. creating nested switch statements 3. two case constants in the same switch can have identical values. 4. efficiency of switch is more than set of nested ifs Question 28: [primitive Values, Wrapper Classes, Types and Casting] (2) int a=11, b=22, c; c= a + b + a++ + b++ + ++a + ++b ; 1. 103 2. 101 3. 102 4. 104 Question 29: [primitive Values, Wrapper Classes, Types and Casting] (1) Which Scanner class method is used to string value from the user? 1. next() 2. nextString() 3. nextLine() 4. Both 1 and 3 Question 30: [primitive Values, Wrapper Classes, Types and Casting] (1) Consider the following object declaration statement: Scanner objName = new Scanner(System.in) ; What is System.in in this declaration? 1. Reference to Input Stream 2. Reference to computer System 3. class which point input device 4. None of these Question 31: [primitive Values, Wrapper Classes, Types and Casting] (1) All the wrapper classes (Integer, Boolean, Float, Short, Long, Double and Character) in Java are 1. private 2. serializable 3. final 4. None of the above Question 32: [Statements, Scope] (2) Consider the below statements and determine the output: String s1 =”MOON” ; String s2 = new String(“Moon”) ; s1=s2 ; System.out.println(s1==s2) ; 1. false 2. true 3. Moon 4. error Question 33: [Computer Hardware] (2) Derive an correct SOP expression for sum and carry for a half Adder. 1. AB’ + AB’ , AB’ 2. A’B + AB’ , AB 3. A’B + AB’ , AB’ 4. AB + A’B , AB Question 34: [Computer Hardware] (1) Identify the number of NOR gates required for the given expression below in NOR-to-NOR logic network: (A’ + B’ + C’) (A + B’ + C) (A + B + C’) 1. 4 2. 8 3. 9 4. 5 Question 35: [Computer Hardware] (1) Which kind of expression is derived in NOR-to-NOR logic 1. Product of Sum 2. Sum of Product 3. Cardinal 4. None of the above Question 36: [Computer Hardware] Answer the given questions below based on the circuit: a) Give the output if, X=1 and Y=0 (1) 1. 0 2. 1 3. None b) Name the basic gate represented by the above diagram. (1) 1. NOR 2. OR 3. XNOR Question 37: [Boolean Algebra] (2) Find the complement of the given expression: F = (A + B’) (B + CD) 1. AB + BC’+ BD’ 2. A’B’ + B’C + BD 3. A’B + B’C + B’D 4. A’B + B’C’ + B’D’ *******************************ALL THE BEST************************************ ―――――――――― ISC Class 12 Boolean Algebra MCQ Test 1 The law which represents the Boolean equation A+Aꞌ =1 is: [1] (a) Associative Law (b) Distributive Law (c) Complementarity Law (d) Absorption Law 2 The dual of the Boolean equation (X·Y)+0 =X·Y is: [1] (a) X+Y+0 (b) X·Y+0=X·Y (c) (X+Y)·1= X+Y (d) (X+Y)+0=X·Y 3 If A=1, B=0,C=1 and D=0,then the minterm will be: [1] (a) AB’C’D.. (c) A+B’+C’+D (b) AB’CD’ (d) A’+B+C+D’ 4 The compliment of the Boolean expression F(P,Q,R)=(P +Q)+R’ is: [1] (a) P’Q’R (b) P’+Q’+R’ (c) P+(Q’+R’) (d) (P+Q)+R’ 5 The propositional operator <=> represents: (a) Conjunction (b) Implication [1] (c) Equivalence (d) Negation 6 Full Adders are used for: [1] (a) Adding three bits (b) Converting Decimal to Binary (c) Converting Binary to Decimal (d) Data transmission 7 NOR gate is formed by the combinations of: (a) AND gate and OR gate (b) OR gate and NOT gate [1] (c) NAND gate and NOT gate (d) AND gate and NOT gate 8 The combinational circuit which has n inputs and 2n outputs: [1] (a) Full Adder (c) Half Adder (b) Decoder (d) Multiplexer 9 The Octet group in a Karnaugh’s map eliminates: [1] a. One variable b. Four variables c. Three Variables d. Two variables 10 The proposition (a→b) is represented by: [1] (a) a'b’+ ab (b) (a'+b’)·(a+b) (c) a’+b (d) None of the above 11 If the input in a decoder is AB’C’D,then the decimal equivalent output will be: [2] a) 8 b) 10 c) 5 d) 9 12 A square matrix M[ ][ ] consists of 100 elements and the address of M[4][8] is 2032. If the base address at M[0][0] is 1840, determine the memory occupied by each element when the matrix is stored in row major wise. [2] a) 4 (b) 3 (c) 2 (d) None of the above 13 Given proposition P =>Q ,answer the following questions: a. The converse of the proposition is: [1] i. Q=>~P ii. Q=>P iii. ~Q=>~P iv. ~P=>~Q b. The contra-positive of the proposition is: [1] i. ~P=>Q ii. Q=>P iii. ~Q=>P iv. ~Q=>~P 14 The reduced expression for the Boolean expression F(X,Y,Z)=π(0,1,2,3,4,5,6,7) is: [2] a) XY’+X’Y b) 1 c) 0 d) None of the above 15 Consider the code snippet given below - what is the value of i, n after code is executed? [2] int i=10; int n=i++%5; a. i=10 n=1 b. i=11 n=1 c. i=10 n=0 d. i=11 n=0 16. Consider the code snippet given below - what is the value of i, n after code is executed? [2] int i=10; int n=++ i %5; a. i=11 n=1 b. i=11 n=0 c. i=10 n=0 d. i=11 n=0 17. What will it printSystem.out.print(“H”+”a”) ; System.out.print(‘H’+ꞌa’); a. Ha169 b. Ha7297 c. Error d. None 18 .Which type of Integer literal does int z= 012 represent? (a) Decimal (b) Octal 17 What will it print? [2] System.out.print(“H” + “a”); System.out.print(‘H’+’a’); (c) Hexadecimal (d) None of the above 19. State which type of boolean expression is this (P → Q) = (Q'→P') [2] (a) Tautology (c) Contingency (b) Contradiction (d) None 20 What is the result after simplification of A.{B + C(A.B+ A.C)'} - [2] (a) AB (c) 0 (b) 1 (d) A+B 21 Reduce the given Boolean function F(P,Q,R,S)=π(2,3,6,7,9,11,12,13,14,15) by using4-variable Karnaugh map and answer the following questions: (a) What will be the least number of groups and their types formed for reduction? [1] i) 3 quads iii) 3 pairs ii) 2 quads, 1 pair iv) None (b) The reduced expression is [2] i) (P+S)(P+S') iii) (P+S)(P'+S') ii) (P+S)(P'+S')(P'+ Q') iv) None 22 Reduce the given Boolean function F(A,B,C,D)=Σ(0,1,3,4,8,9)by using4-variable Karnaugh map and answer the following questions: (a) What will be the least number of groups and their types formed for reduction? [1] v) 2 quads vii) 2 pairs,1 quad vi) 1quad, 2 pairs viii) None (b) The reduced expression is [2] i) B'C' +A'C'D iii) BC+ACD+ABD ii) B'C' +A'C'D +A'B'D iv) None 23 a) Full Adder adds how many bits- [1] i) 2 ii) 3 iii) Any number iv) None b) Equation of SUM, CARRY in Full Adder is- [2] i) X XOR Y XORZ, XY+YZ ii) X XOR Y, XY+YZ+ZX iii) X XOR Y XORZ, XY+YZ +ZX iv) None 24 A training institute intends to give scholarships to its students as per the criteria given: • The student has excellent academic record but is financially weak. OR • The student does not have an excellent academic record and belongs to a backward class. OR • The student does not have an excellent academic record and is physically impaired. The inputs are: A Has excellent academic record F Financially sound C Belongs to a backward class I Is physically impaired (In all the above cases 1 indicates yes and 0 indicates no). Output: X [1 indicates yes, 0 indicates no for all cases] Draw the truth table for the inputs and outputs given above and write the SOP expression for X (A, F, C, I) a) The Reduced expression for above problem- [2] i) X(A,F,C,I)=Σ(1,2,3,5,6,7,8,9,10,11) ii) X(A,F,C,I)=Σ(1,2,3,5,6,7,8,9) iii) X(A,F,C,I)=Σ(1,2,3,5,6,7,8,9,11) iv) X(A,F,C,I)=Σ(1,2,3,5,6,7) b) The maximum input combinations here are- [1] i) 24 ii) 16 iii) 8 iv) None 25 a) If F (A, B, C) = A’ (BC’ + B’C), then find F' [2] i.A+(B’ +C)(B+C’) ii.A'(BC') iii. A' B+ C iv.None b) The law used here- [1] i) De Morgan’s Law iii) Idempotence Law ii) Associative law iv) Distributive Law 26 a) Canonical Expression is Boolean expression composed of [1] i) entirely either of minterms or maxterms ii) entirely of minterms iii) entirely of maxterms iv) None b)Convert the following expression into its canonical POS form: [2] F (X, Y, Z) = (X+Y’). (Y’+Z) i) (X+Y+Z) (X+Y) ii) (X+Y'+Z)(X+Y'+Z’)(X'+Y'+Z) iii) (X+Y'+Z)(X'+Y'+Z) iv) (X+Y'+Z’)(X'+Y'+Z) 27 a)F(L,M,O,P)=π(0,2) what is the canonical form of this cardinal expression- [1] i. (L+M+O+P)(L+M+O'+P) ii. (L+M+O'+P) iii. (L+M+O'+P) iv. None b) Reducing the option i) of the above question gives- [2] i) L+M+P iii) M+P ii) L+M iv) 1 28 a)Binary search works with- [1] i) Only unsorted arrays iii) Both types ii) Only sorted arrays iv) None b) Linear search works with- [1] i) Only unsorted arrays iii) Both types ii) Only sorted arrays iv) None c) Which is more efficient? [1] i) Binary search iii) Both Equally efficient ii) Linear Search iv) None 29. The following function is a part of some class. Assume ‘n’ is a positive integer. Answer the given questions int unknown (int n) { int i, k; if (n%2 = = 0) { i = n/2; k=1; } else { k=n ; n--; i=n/2; } while (i > 0) { k=k*i*n ; i--; n--; } return k; } a) What will be returned by unknown(5)? i. 60 ii. 120 b) What is being computed by unknown (int n)? i. Addition ii. Factorial (7) [2] iii. 6 iv. none [1] iii. Addition and product iv. None 30. Which values will be stored in myArr and k after you invoke fun(myArr, k) where myArr, k and fun( ) are declared below– [3] int myArr [ ]={1, 2, 3 ,4, 5}; int k = 3; void fun(int a[ ], int m) { ++a[m]; - - m; } a) 1,2,3,4,5 and 3 c) 1,2,3,4,5 and 4 b) 1,2,3,5,5 and 3 d) 1,2,3,5,5 and 2 31. The following code segment checks if a positive integer is an Armstrong number by returning true or false. (Armstrong number - the sum of the cubes of all its digits is equal to the original number.) The function does not use modulus (%) operator to extract digit. Replace the places in the code marked by ?1?, ?2?, ?3?, ?4?, ?5? appropriatelyboolean ArmstrongNum(int N) { int sum = ?1?; int num= N; while(num>0) { int f=num/10; int s= ?2?; int digit = num-s; sum+=?3?; num= ?4?; } if(?5?) return true; else return false; } a) What is the statement or expression at ?1? i. 1 ii. 0 b) What is the statement or expression at ?2? i. 0 ii. 1 c) What is the statement or expression at ?3? i. f*f*f ii. f*f d) What is the statement or expression at ?4? i. num*10 ii. num/10 iii. num+10 iv. num iii. num iii. f iii. f+=1 iv. f*=1 [1] iv. none [1] iv. none [1] [1] e) What is the statement or expression at ?5? [1] i. s= = f iii. s= = digit ii. s= = n iv. None 32. The following code segment computes and returns the greatest common divisor of any two numbers. Replace the places in the code marked by ?1?, ?2?, ?3?, ?4? and ?5? appropriately- int gcd(int a, int b) { int r. while(?1?) { r = ?2?; b = ?3?; a = ?4? } if (a ==0) return ?5?; else return-1; } a) What is the expression or statement at ?1? i. a!=0 ii. b!=0 b) What is the expression or statement at ?2? i. a ii. b c) What is the expression or statement at ?3? i. a ii. b d) What is the expression or statement at ?4? i. a%b ii. a/b e) What is the expression or statement at ?5? i. a ii. b iii. a * b! = 0 iii. 0 iii. r iii. a==b iii. r [1] iv. none [1] iv. 1 [1] iv. none [1] iv. none [1] iv. 1 ―――――――――― ISC Class 12 First Semester Paper 1 (with answers) COMPUTER SCIENCE-FIRST SEMESTER EXAM PAPER-1 (THEORY) 1. The law which represents the Boolean equation (A+A’) = 1 is [1] a. Associative law b. Complementary laws c. Commutative law d. Demorgan’s Law Ans. (b) complementary laws 2. The dual of the Boolean equation A+1+B’+C [1] a. A’+0+B’+C b. A+0+B’+C c. A.0.B.C d. A.0.B’.C Ans: (d) A.0.B’.C 3. If A=1, B=0, C=0 and D=1, then MINTERM will be [1] a. A+B+C’+D b. AB’C’D c. A.B.C.D d. A’+B+C+D’ Ans : (b) AB’C’D 4. The complement of the Boolean Expression is (A+B) (B+C) (A+C). [1] a. (A+B) +(B+C) +(A+C) b. (A.B)’+ (B.C)’+ (A.C)’ c. A’B’+B’C’+A’C’ d. NONE Ans: (c) A’B’+B’C’+A’C’ 5. The propositional operator <-> represents [1] a. Conjunction b. Disjunction c. Implication d. Bi-implication Ans: (d) Bi-implication 6. (3X8) Decoders are used for: [1] a. Adding for two binary bits b. Adding for three binary bits c. Converting Binary to octal d. Converting Decimal to binary Ans: (c) Converting Binary to octal 7. Choose the correct expression For XNOR gate [1] a. A’B’+AB b. A’B+AB’ c. AB+AB’ d. (A+B) . (A+B)’ Ans:(a) A’B’+AB 8. The combinational circuit which adds three binary bits is [1] a. Half Adder b. Full Adder c. Encoder d. Decoder Ans (b). Full Adder 9. The octet group in a Kmap eliminates [1] a. One variable b. Two variable c. Eight variable d. None Ans (c) Eight variable 10. The Proposition [[(pq) ^p]q is a [1] a. Tautology b. Contradiction c. Contingency d. Contrapositive Ans a. tautology 11. If the input in a decoder is AB’C’D’ , then the decimal equivalent output will be [2] a. 8 b. 10 c. 5 d. 7 Ans: (a) 8 [2] 12. A character array B[7] [6] has a base address 1046 at 0, 0. Calculate the address at [B[2] [3] if the array is stored Column Major wise. Each character requires two bytes of storage a. 1092 b. 1920 c. 9012 d. none Ans: (a) 1092 13. With reference to the given proposition ~P~Q, answer the following questions: (a) The contrapositive of the proposition is: [1] (i) PQ (ii) QP (iii) ~Q~P (iv) NONE Answer: (ii) QP (b) The inverse of the proposition is: [1] (i) ~Q~P (ii) PQ (iii) P~Q (iv) ~QP Ans: (ii)PQ 14) dual of P’QR’ + PQ’R + P’Q’R is equal to the complement of [2] a. PQ’R+ Q. (P’R’+PR’) b. P’Q’R’+ Q.P’R’+PR’) c. PQ’R’+Q+(P’R’+PR’) d. NONE ANS: (a) PQ’R+ Q. (P’R’+PR’) 15) State the final value of q after the execution of the given code [2] int m,n,q=0,p; for(m=2;m<=3;++m); { for(n=1;n<=m;++n); { p=m+n-1; if(p%3==0) q+=p; else q+=p+4; } } a. 12 b. 29 c. 92 d. Syntax error Ans: (a) 12 16) What is the output of the statement given below? [2] System. out .print(Integer .parseInt(“234”)+’A’); a. 234+65 b. 234A c. 299 d. Error Ans: (c)299 17) What is the output of the statement given below [2] System. out. print(‘A’+’1’+’C’) a. 65+1+66 b. 10+1+67 c. 181 d. 65+49+67 c) 181 18) The simplified form of the function F is [2] a. XY b. XZ c. (X+Y).XZ d. YZ Ans. (b) XZ [2] 19) A square matrix is said to be a lower triangular matrix if all the entries above the =[diagonal are zero. The following code checks for whether mat array is lower triangular matrix and returns 1 if it’s a triangular matrix otherwise it returns 0 int check_ lower _triangular _matrix(int mat[N][N]) { int i, j; for (i = 0; i < N; i++) for (j = i + 1; j < N; j++) if (?????1??? ???2???) return 0; return 1; } What should be replaced with ????!???? and ?????2????? a) Mat[i][j], !=0 b) Mat[j][i], ==0 c) Mat[i][j],>0 d) Mat[i][j], >=0 Ans) (a) Mat[i][j], !=0 20. The proposition ( X⇔Z) . [(X⇒Y). (Y⇒Z) is a [2] a. tautology b. contradiction c. contingency d. contrapositive Ans (c) contingency 21. Reduce the given Boolean function F (A, B, C,D)=∑( (0, 2, 3, 4, 5, 8, 10, 11, 12, 13). By using 4-variable K-Map and answer the following questions: (a) what will be the least number of groups and their types formed for reduction? [1] (i) 4pairs (ii) 3 quad (iii) 2 quad , 1 pair (iv)4 quad (a)(iii) 3 quad (b)The reduced expression of the Boolean function given above is: [2] (i) B’D’+BC’+B’C (ii) BD+BC’+BC’ (iii)B’D’+B’C’+B’C’ (iv)None (b) (iv) none 22) The owner of a company pays the bonus to his salesmen as per the criteria are given below: If the salesman works overtime for more than 4 hours but does not work on off days/ holidays. OR If the salesman works when festival sales are on and updates showroom arrangements. OR If the salesman works on an off day/holiday when the festival sales are on. The inputs are: INPUTS O Works overtime for more than 4 hours F Festival sales are on H Working on an off day/holiday U Updates showroom arrangements (In all the above cases 1 indicates yes and 0 indicates no) [2] (a) The POS expression for X(O,F,H,U) will be I. F(A,B,C,D)=∏(0,1,2,3,6,10,11) II. F(A,B,C,D)= )=∏(0,1,2,3,4,10,11) III. F(A,B,C,D)=∏(0,1,2,3,5,10,11) IV. F(A,B,C,D)=∏(0,1,2,3,4,9,11) ANS: (ii) F(A,B,C,D)= )=∏(0,1,2,3,4,10,11) (b) The maximum input combinations for the above truth table will be: [1] (i) 24 (ii) 16 (iii) 8 (iv) 4 (b) (iv)4 23) Given the Boolean function : F(P, Q, R, S) = Π (0, 1, 3, 5, 7, 8, 9, 10, 11, 14, 15) by using 4 variable kmap answer the following questions (a)What will be the least number of groups and their types formed for reduction [1] (i) three pairs (ii) three octets (iii) three quadrants (iv)two quadrant and one pair Ans: (iii) (three quadrants) (b) The reduced expression of the Boolean function is [2] i) (S+R) (P+Q)(S+R’) ii) (Q+P) (S’+R)(P+R’) iii) (Q+R) (P+S’)(P’+R’) iv) NONE Ans: (iii) (Q+R)(P+S’)(P’+R’) 24) F(A,B,C) From the logic diagram given above where A,B,C are the inputs and F is the output , answer the following questions a. The expression at (1) is [1] (i) (A.B)’ (II)(A+B) (iii) (A+B)’ (iv) (A.B) Ans : (iv)(A.B) b. The expression at (3) is [1] (i) (A+B+C)’ (ii) (A’+B’+C’)’ (iii) (A’+B’+C’) (IV) NONE Ans. (iii) A’+B’+C’) c) The final expression (4) of f(A,B,C) IS [1] (i) F= (A.B)+(A.B.C)+(A’+B’+C’) (ii) F=(A.B).A.B.C).(A’+B’+C’) (iii) (A.B)+(A.B.C)’+(A’+B’+C’) (iv) (A.B)+(A.B.C)+(A+B+C’)’ Ans: (i) F= (A.B)+(A.B.C)+(A’+B’+C’) 25) Given the Boolean expression F = ( P + R) · ( P·Q + Q·R’ ), identify (a) the complement of the expression [2] (i) P’R’ + (P’+Q’).(Q’+R) (ii) (P’+R’) . (P’+Q’) + (Q+R’) (ii) P’R’ .(PQ’ + Q’R) (iv) (P+R)’ .(P’+Q).(Q’+R) Ans ((i) P’R’ + (P’+Q’).(Q’+R) (b) The law used is: [1] (i) Distributive law (ii) Demorgan’s law (iii) Associative law (iv) Distributive law Ans: (ii) Demorgan’s law 26 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 Afunction(int x, int y) { int p=1,n=x; while(y>0) { if(y%2==1) P*=n; y/=2 n*=n; } return p; } (a) What will be returned by Afunction(2,7) [2] (i) 256 (ii) 128 (iii) 64 (iv) None Ans.(ii) 128 (b) State that what is being done by Afunction(int,int) in general [1] (i)finding sum of x and y (ii) finding x raised to y (iii)finding y raised to x (iv)finding product of x and y Ans: (ii) finding x raised to y 27) with reference to the code given below answer the questions that follow void show(int n, int d) { While(n>1) { if(n%d==0) { System.out.print(“\t”+d); n=n/d; } else d++; } } a. What is the output of function show (24,2) [2] (i) 2 2 2 3 (ii)2 2 3 2 (iii)3 4 7 (iv)2 2 3 2 Ans (i) 2 2 2 3 b. State what is being computed by show(x,y) [1] (i) finding factors of n (ii) finding prime factors of n (iii) finding multiples of n (iv) none Ans: (ii) Finding prime factors of n 28) with reference to the program code given below void dimen(int n[][]) { int t=0; for(int i=0;i<n.length;i++) { for(int j=0;j<n[0].length;j++) { if(i==j) t=t+n[i][j]; } } System.out.println(t) } (a) What will be the output of the method dimen() when the value of [2] n[][]={{1,2,3},{3,4,5},{6,7,8}} (i) 44 (ii) 15 (iii) 20 (iv) 13 Ans: (iv) -13 (b) What is the method dimen() performing [1] (i) Finding sum of non-boundary elements (ii) Find sum of boundary elements (iii) Finding sum of diagonal elements (iv) Finding sum of non diagonal elements Ans-(iii)- Finding sum of diagonal elements 29)with reference to the program code given below ,answer the questions that follow void solve(int x[]) { int sum=0; for(int i=0;i<x.length;i++) { sum=sum+(x[i]*x[i]); } System.out.println(sum); } } (a) What will be the output of the method solve()when the value of x[]= {1,2,3,4,5} (i) 40 (ii) 55 (iii) 30 (iv) 60 Ans –(ii)-55 (b) what is the method solve() performing (i) sum of the elements (ii) sum of the odd elements (iii) sum of the squares of the elements (iv) sum of the even elements Ans-(iii) sum of the squares of the elements [2] [1] 30.With reference to the program code below , Answer the question that follows int dec=0, c=0; int perform(long n) { while(n>0) { int d=(int)n%10; dec=dec+d*(int)Math.pow(2,c++); n=n/10; } return dec; } a). What will be returned by the method perform(1110) [2] (i) 12 (ii) 14 (iii)15 (iV)1 Ans-ii-14 b) What is the method perform() doing [1] (i) finding octal equivalent (ii) find decimal equivalent (ii) finding … (see the PDF for the full paper)