Page 1 :
S.J. EDUCATION CENTRE, AfMllated to ICSE /ISC, , Half Yearly Examination -2021-22, Subject:-Computer Science, , Time- Two Hours, , Note, , Class-XII, , M.M.- 70, , Attempt all the questlons in neat and clean handwriting, No need to copy the, questions. WRITE ANSWERS ONLY, Section A, (40 Marks, , (MCQ Based Question and give reason for Support of Answer/Brief, , Working), Q.1. What will be the output of the following program?, , [1, , public class MyFirst {, public static void main(String[] args) {, MyFirst obj = new MyFirst(n);, , static int a=10;, static int n, , intb=5;, int c;, , public MyFirst(int m) {, System.out.println(a +, , ", ", , +b+", "+ c+","+n+", "+m);, , / Instance Block, , b 30;, n, , 20;, , I/ Static Block, static, , a, , 60;, , a) 10, 5, 0, 20, 0, , .b) 10,30,20, c) 60, 5, 0, 20, d) 60, 30, 0, 20, 0, , Q.2. The lu0021 article referred to as a, , [11
Page 2 :
a) Unicode escape sequcrce, , ), , Octal escape, , b) Hexadecimal, , d), , Line feed, , Q3. i s used to find and fix bugs n the Java programs., , a) JVM, , b), , c), , JRE, , JDK, , d), , JDB, , Q.4. Which of the following is a valid declaration of a char?, , charch= "utea;, , a), , b), , d), , char cr = \u0223;, , char cc= "itea';, , 1, , Which of the following is a valid long literal?, , Q.5., , a), , char ca= 'tea';, , ABH8097, , L990023, , c), , 904423, , d), , Oxnf029L, , (1, , Q.6. What does the expression float a =35/0return?, a ) Not a Number, c), b) Infinity, d) 0, exception, , Run time, , Q.7. What will be the output of the foliowing program?, , (11, , public class Test {, , public static void main(String[] args) {, , intcount=1;, while (count=15) {, System.out.println(count % 2=1?"***" "4+++"):, } / end while, , +count;, , ll end main, , }, , a) 15 times ***, , c), , 15 times++++, , b) 8 times*** and 7 times ++H+, , d), , Both will print only once, , Q.8. Which of the following for l0op declaration is not valid?, , a) for (inti 99; i>=0; i/9), b) for (inti =20; i>=2;--i), =, , Q.9., , which, , for (inti=7;i=7;i+=7), d), , for( int i=2; i=20; i =2* i), , option is false about the final keyword?
Page 3 :
a), a), , A final method cannot be overridden in its subclasses., , b)A final class cannotbe extended., c)A final class cannot extend other classes., , A final method can be inherited., , d), , In which memory a String is stored, when we create a string, , Q.10., , using new operator?, , b), , Stack, , a), , String memory, , c)Heap memory, , d), , Random, , storage space, , Q.11. The systematic reduction of logic circuits is accomplished, , by, a), , Symbolic reduction, , b), d), , TTL logic, Using a truth table, , b), , BCD'+A'C°D+BD', , [1, , c) Using Boolean algebra, Q.12. Simplify the expression using K-maps: F(A,B,C,D}=2, 1,3,5,6,7,11,13,14)., a), , AB+BCD+A'B'C, , c), , A'D+BCD+A'BC+AB'C' d), , None of These, , Q.13. In Gray coding, the adjacent code values differ by, , a)singlebit b), , 3 bits, , c), , 10 bits, , d), , 0 bit, , Predict the Output:., , Q.14., , Let a "God is Great, import java.util.";, class demo, , public void main), Scanner sc =new Scanner(System.in);, , System.out.println("Enter sentence");, String a-sc.nextLine();a-a.trim);a-" "tat" "int cnt=a.length);, String b="",c=";, , for(int i-0;i<a.length(0;it+), ifa.charAti=), , if(b.length)<cnt)&&(b.length)!-0)
Page 5 :
a) tolbelorl belto1, b) Both a and c, , c) to2be2orlnot1, d) None of these, , Q.16., , A provisional store announces a special discount on all its, , product as a festival offer only to those who satisfy any one of the, , following conditions:, *If he/she is, , an, , employee ofthe store and has a service of more than 10 years., OR, , Ifhe/she is a regular customer of the store whose age is less than 65, , years and is not an employee of the store., , OR, , If he/she is a senior citizen but not a regular customer ofthe store., , The inputs are, E: Employee ofthe store, , R:Regular customer of the store, , S:Service of the employee is more than 10 years, C: Senior citizen of 65 years or above, , Output, x-Denotes eligible for discount [1 indicates YES and 0 indicates NO in all, , cases, Reduce the expression and trick how many octet, quad, pair and*Singlet., , b), a) 2quad,2 pair, d) None of These, Q.17., , a), c), , 1, , quad, 3pair, , 1 octet,2 quad, , Convert the following into postfix: (A+B/C)+B-C*D+C, AB+C/BC*+C+, , b)AB+C/BC*+C+, , ABC+BC*+C+, , d), , None of these, , [1
Page 6 :
An array ARR[10]|5] is stored in memory with each element, , Q.18., , required 2 bytes of storage. If the element ARR[O][0] is stored at the, location 1250, Calculate the location of ARRS] [6] when the array is, , [1, , stored row major wise, , a), Q.19., , b), , 1406, , 1306, , c), , 1304, , d), , None of these, , Reduce the following to its simplest form using laws of Boolean, Algebra. At each step clearly state the law used for simplification. [1], , AB'+A'BC+ (AC) + BC, a)l, , b)0 c)AB D)AB+1, , Q.20. Simplify the following expression and convert it to its canonical, , POS form:, , (x.y+2)y+z'.x), , ax*y).x+z).y+2).(y+x), b) x+y+2).(xtz*y)-(y+z'+x).(y+x+z), , c)ty+) xty+2'%xty+2K*y'+2)0%*+y+z)(x*+y'+2(x*y+7«ty+7), d) None of these, , Q21. Sclect the Canonical Sum-Of-Products for the given truth table, where A,B,C areinputs and X is output:, A, , BB, , CX, , 0, 1, , 1, 1, , 1, , [
Page 7 :
a)A'B'C' +A'BC+ AB'C+ ABC, AB'C'+ABC', A'B'C' +A'BC', , b), , +, , +AB'C'+ A'B'C', , c)A'B'C'+A'BC+, , d), , AB'C+ ABC, , A'BC'+ A'BC', , The language that allows to define prepositlons whose truth, , Q .22., , can be determined from the truth of other prepositlons is known as, , [1], , a)Syliogism, , b), , c)Wff d), , Truth table, , Boolean expression, Select the compliment of the Boolean expression: X'+XY [1], , Q.23, , )X.X'+Y) b), , X+X'.Y, , c) X*.(X+Y'), , d), , None, , of these, FP, Q R) =r(1,3) is the expression given in its cardinal form., 0.24., [1], Select its following canonical form., , a) (P +Q' +R°).(P+Q+R), Q+R), 1 (P+Q+R').(P" +Q' +R'), , c), , (P+Q' +R).(P° +, , d), , (P+Q+R').(P+, , Q+R'), Q.25. If A=1 and B 0, then (4 +B°)' is:, =, , c), , a) 0, , d) (1+0 ), , b) 1+0, , From the following logic circuit diagram, after simplifying it, state the law represented by the logic diagram., , Q.26., , b) Associative law c)Absorption law, , a) Distributive law, None of these, , Q.27. Following is the truth table of:, , AB, 0 0, , 01, 1, , 1, , 0, , 11 1
Page 8 :
a)XOR gate b), , c), , NOR gate, , XNOR gate, , d), , OR gate, , Q.28.Sclect the logic gate diagram of XNOR is:, , b), c), d), Q.29. The elementary statement which may be either true or false is, known 8s, , [1, , a) Syllogism b) Premises, )Proposition, d), Operator, Q.30. The proposition that contains both true (1) or false (0)values in the, output column is known as, , a) Tautology, , d)Condingeacy, , [1, c)Contrapositive, , b)Contradiction, , Q.31. Select the reduced expression for the given Karnaugh map:, , C'D', , [1, , C'D CDCD, , A'B, , 1, , AB, , AB', a) B'C' + BC + ACD, , c), b) AB'C+ +A'B'C' +BC+ACD' d), , B'C'+B'C+A'CD', , B'C' +BC+ ACD, , Q.32. Select the correct option for the given proposition: ~(A ^B)V, , (A B), a) Tautology b), , Contradiction, , None of these, , c)Contingency, , [1], d), , Q.33. Consider the following propositions and select the correct answer, , for A B, A: It is August, , B:Itis rainy season, , a., , If and only if it is not August then it is not rainy season, , b., , Ifit is August then it is rainy season, , C., d., , It is August and it is rainy season, If it is not August then it is not rainy season, , [1
Page 9 :
(101), Q.34. If A =1,B=0, then select the correct answer for (A'+®').B'+, A, a) A, b) 0, d) A, c)1, Q35. The combinational circuit that adds two Binary digits is ., a) Full adder, b) Half adder c), Encoder d) Decoder, , Q.36. Identify the Boolean Law/theorem:A +A'=, a) Idempotence law, c) Associative law, b) Absorption law, , d), , Complementarity law, , Q.37. What is the term called which consist of product of all the literals in, the given logi system?, , a) Canonical, , b) Minterm c)Maxterm, , d), , 1, , Karnaugh map, , Q.38. The expression represented in the form of decimal numbers is, called as, 1, a) Cardinal, b) Canonical SOP c)Canonical POS d) None ofthese, , Q.39. Select the F*ifF=(4+B). B+C'+1, a) (A B)+B. C'+0, )(A'.B')+B.C.0-, , b) (A.B)+B'. C'.00, , d), , (A.B)+B'.C'.1, , Q40.Consider the proposition and select ihe correctanswer for-A ~B, , A: Weather is good., a, , b., , B:I am going to school., , Weather is not good AND I am not going to scho0ol, Weather is not good OR I am going to school., , C., , Weather is not good OR I am not going to&hool., , d., , NOT weather is good AND NOTI am going to school., , SECTION-B(30 Marks, , Answer any.three questionsS., , Each program should be written in such a way that it clearly depicts the, , logic of the problem., This can be achieved by using mnemonic names ánd comments in thee, , program., (Flowcharts and Algorithms are not required.), written in Java., , The programs must be
Page 10 :
Q.41 A class Palin has been defined to check whether a positive, , number is a Palindrome, , number or not., The number 'N' is palindrome if the original number and its reverse, are same., , Some of the members ofthe class are given below:, , Class name, , Palin, , Data members/instance, variables:, Num, , :integerto store the number, , Revnum, , integer to store the reverse of the, number, , Methods/Member, functions:, constructor to initialize data members, , Palin(), , with, , legal initial values, void accept(), , to accept the number, , int reversefint y), , reverses the parameterized, and, , stores it in "revnum', recursive, , argument 'y', , using, , Technique, void check(), , .checks whether the number is a, Palindrome by, , invoking the function reverse() and, , display, the, , result with an, , message, , 12, , appropriate, , [10
Page 11 :
class, giving the details of the constructor( ), void, Specify, the, Palin, accept( ), intreverse(int ) and void check( ). Define the main() function, , to create an object and call the functions accordingly to enable the task., Design a class primeFibo to fll an array of order size n where, , Q42., , the maxinmum value of n is 20, with the first n Fibonacci terms that, , are prime., , 10, , The details of the members of the class are given below:, , primefibo, , class name, , data members, , int arr[], int n, , integer array to store maximum 20 elements, to store the actual number of elements in'array., , Member functions:, , : to initialize the data members, , primeFibo(O, boolean primeint), , return true if parameterized value is, , prime, , otherwise, , returns false., void filIFibo(int p), , to fill first p priue Fibonacci terms in array where, value of p receive the value from n from main method., , void display(), , : display, all the prime Fibonacci terms filled in, , array.., Now write a main method to input size of array in n and filled the arrfn], with first, , n, , prime Fibonacci terms by calling appropriate, , methods., , Q43. Design a class Alpha which enables a word to be arranged in, [10, ascending order according to its alphabets., The details of the members of the class, , Class name:Alpha, Data members instance variables:, Str: to store a word, , are, , given below:
Page 12 :
Member ftdons, Alpha ), , default constructor, , void readword(), , to accept the inputted word, , void arrange (), , to, , any, , arrange the word in alphabetical, , order using, , standard sorting technique., , void disp(, , displays the word., , Specify the class Alpha giving details of the constructor and the, member functions void, readword), void arrange(), void, () and, defining the main () function to create an object and call thedisp, function in order, to execute the class, by displaying the original word and the changed word, with proper message., Q.44.Write a program to declare a, M' s the numbers of rows and 'N' is thematrix A[I] of order (Mx N) where, number of columns such as the, value of both 'M' and "N' must be, greater than 2 and less than 10. Allow the, , user to input Intagrs into thls iatrs., Perfom the following the following, , ) Display original matri, i) Sort each row öf the, , technique., the, (ii), Display, , 10], , tasks on the matrix:, , matrix in, , ascending, , order, , using standard sorting, , change matrix after sorting each row., , Example 1: Input: M =4 , N=3, , Output: 0riginal matrix, 11, 5, , 9, 3, , -2, 16, 0, 1, , 3, 7, 4, , 8, , Matrix After Sorting Rows, , 4, , 11, 16, 9