Formatting page ...
STRATFORD DAY SCHOOL (ICSE & ISC) Affiliated to the CISCE (WB-339), New Delhi Mock Test - III 2024 2025 Full Marks 70 Class XII Time . COMPUTER SCIENCE Maximum Marks: 70 Time Allotted: Three Hours Reading Time: Additional Fifteen minutes : Instructions to Candidates : You are allowed additional 15 minutes for only reading the question paper. You must NOT start writing during the reading time. It is divided into two parts and has 11 questions in all. Part I is compulsory and has two questions. Answer all questions. Part II is divided into three sections: A, B and C. While attempting Multiple Choice Questions in Part I, you are required to write only ONE option as the answer. Each section in Part II has three questions. Any two questions have to be attempted from each section. The intended marks for questions are given in brackets [ ]. Part I (20 Marks) [Answer all questions] Question 1 [10 x1=10] i) Choose the correct output of Java program with arrays: public class Polo { public static void main(String args[]) { String[] computer = { RAM , HDD , MOUSE }; String[] parts = {computer[0],computer[2]}; System.out.print(parts[1]); } } (a) RAM (b) HDD (c) MOUSE (d) Compiler error ii) The disadvantage of the array is : (a) Stack and Queue data structures can be implemented through an array. (b) Index of the first element in an array can be negative (c) Wastage of memory if the elements inserted in an array are lesser than the allocated size (d) All iii) Match the columns: (a) 1-(ii), 2-(i), 3-(iv), 4-(iii) (b) 1-(i), 2-(ii), 3-(iv), 4-(iii) (c) 1-(ii), 2-(i), 3-(iii), 4-(iv) (d) 1-(ii), 2-(iv), 3-(i), 4-(iii) iv) Simplify the following expressions: F(A, B, C) = S(2, 3, 5, 4) What will be the smallest number of groups and their types formed for reduction? (a) 2 pairs (b) 1 pair (c) 4 pairs (d) 3 pairs v) The reduced appearance of the Boolean function given above (iv) is: (a) AB + AB (b) AB + BA (c) A + B (d) A vi) From the logic diagram given above, where A and B are inputs and X is the output, answer the following questions: The Final expression is: (i) A B + AB (ii) A + AB (iii) AB + B (iv) AB + A vii) Software developers of Banayan High School have created a class to store the name, ageand height of students. If the class shown below compiles correctly, which of the following will be the correct statement to create an object and pass values as an argument? class Student Banyan { String name; int age; double height; StudentBanyan(String n, int a, double h) { name = n; age = a; height = h; } //implementation not shown here } Which one of the following is the correct statement of using a constructor? (a) StudentBanyan stud1 = new StudentBanyan("Kylin",5.6, 23); (b) StudentBanyan stud1 = new StudentBanyan("Kylin",23, 5.6); (c) StudentBanyan stud1 = new StudentBanyan(5.6, "Kylin",23); (d) StudentPine stud1 = new StudentPine(5.6, 23, "Kylin"); viii) String s1= "Gujarat"; String s2= new String("Gujarat"); String s3= new String ("Gujarat"); String s4= "Gujarat" ; How many String objects are created in the above snippet? Justify your answer. ix) Finding the greatest common divisor (GCD) of two positive integers results in the time complexity of O(log N) where N is the larger number of two inputs . Justify the statement. x) Find the output of following snippet: String S1= "AB" , S2= "BC"; for(inti=0, j=0 ; i<S1.length( ) ; i++, j++) System.out.println(S1.charAt(i)+S2.charAt(j)); Question 2 i) Convert from infix to prefix form: [5x2=10] N U+M (B (E R)) ii) A two dimensional array defined as x[3 6, -2 2] requires 2 bytes of storage space for each element. If the array is stored in row major order, determine the address of X[5,1], given the base address as 1200. iii) public void Recur(int n) { if ( n>1 ) { System.out.print ( n + " " ) ; if ( n%2 != 0 ) { n=3*n + 1; System.out.print ( n + " " ) ; } Recur ( n/2 ) ; } } iv) What will be the output ifn = 10 ? The given code fills an array with non-duplicate elements. Fill in the ?n? marked blanks. (do not copy the code) double[ ] fnArrayFill ( int s ) { double WED[ ] = ?1?; double tmp = 0; int j = 0; while ( j<=s-1 ) { tmp = Math.random(); boolean present = ?2?; for( int k = 0; k<j; k++) { if(WED[j] == WED[k]) { System.out.println( tmp + already present ); ?3? break; } } if(present == ?4? ) { WED[j] = tmp; ?5? } } return ?6? ; } v) Show that : Dual of ( p .q.r + p.q .r + p .q .r ) = Complement of ( p.q .r + q.(p .r + p.r ) ) Part II (50 Marks) Answer six questions in this part, choosing two questions from Section-A, two from Section-B and two from Section-C Section A [Answer any two questions] Question 3 i) Mr B wanted to design a machine for taking decision on whether or not he should go for morning walk on a particular day. He goes for a morning walk if : he has to go for check-up and he has night shift duty. there is someone at home and the season is not summer. there is no one at home but he has to go for check-up. Inputs are : C : He has to go for check-up. D : He does not have night shift duty. H : There is no one at home. S : The season is summer. Output is : W : Mr B goes for a walk.[1 indicates yes & 0 indicates no] (a) Draw the truth table for the inputs and outputs given above. Write the Sum Of Product expression for W (C, D, H, S). [2] (b) Reduce W (C, D, H, S) using Karnaugh s map. [1] (c) Draw the logic gate diagram for the reduced expression for W (C, D, H, S) using elementary gates. You may use gates with two or more inputs. [2] ii) Given the Boolean Function F(A,B,C,D) = 0,1,6,7,8,9,10,14,15). a) Use Karnaugh's map to reduce this function F, using the given SOP form. b) Draw the logic gate diagram for the reduced SOP form. [4] [1] Question 4 i) Given the Boolean function: F(A, B, C, D) = (3, 4, 5, 6, 7, 10, 11, 14, 15). (a) Reduce the above expression by using the 4-variable Karnaugh map, showing the various groups (i.e., octal, quads and pairs). [4] (b) Draw the logic gate diagram for the reduced expression. Assume that the variables and their complements are available as inputs. [1] ii) Using the truth table, state whether the following proposition is a tautology, contingency or a contradiction: [3| ~(A B) (~A=>B) iii) Simplify the following expression, using Boolean laws: A.(A + B).C.(A + B) Question 5 i) Convert the following Boolean expression into its canonical POS form: F(A, B, C) = (B + C ).(A + B) ii) Draw the circuit diagram for a 8 : 1 Multiplexer. iii) Prove the Boolean expression using Boolean laws. Also, mention the law used at each step. F = (x + z) + [(y + z).(x + y)] = 1. iv) Find the complement of the following Boolean expression using De Morgan s law: AB + A + BC [2] [2] [4] [3] [1] Section B [Answer any two questions] Question 6 A disarium number is a number in which the sum of the digits to the power of their respective position is equal to the number itself. [10] 1 2 3 Example: 135 = 1 + 3 + 5 Hence, 135 is a disarium number. Design a class Disarium to check if a given number is a disarium number or not. Some of the members of the class are given below: Class name: Disarium Data members/instance variables: intnum: stores the number int size: stores the size of the number Methods/Member functions: Disarium (intnn): parameterized constructor to initialize the data members n = nn and size = 0 void countDigit(): counts the total number of digits and assigns it to size intsumofDigits (int n, int p): returns the sum of the digits of the number(n) to the power of their respective positions (p) using recursive technique void check(): checks whether the number is a disarium number and displays the result with an appropriate message Specify the class Disarium giving the details of the constructor! ), void countDigit(), intsumofDigits(int, int) and void check(). Define the mainfunction to create an object and call the functions accordingly to enable the task. Question 7 A class ConsChange has been defined with the following details: [10] Class name: ConsChange Data members/instance variables: word: stores the word len: stores the length of the word Member functions/methods: ConsChange(): default constructor void readword(): accepts the word in lowercase void shiftcons(): shifts all the consonants of the word at the beginning followed by the vowels (e.g. spoon becomes spnoo) void changeword(): changes the case of all occurring consonants of the shifted word to uppercase, for e.g. (spnoo becomes SPNoo) void show(): displays the original word, shifted word and the changed word Specify the class ConsChange giving the details of the constructor ), void readword ( ), void shiftcons (), void changeword() and void show(). Define the main() function to create an object and call the functions accordingly to enable the task. Question 8 A Class Sort contains an array of 50 integers. Some of the member functions / data members are given below: [10] Class name: Sort Data Members/ instance variables: arr[] : integer array item: number to be searched for in the array Member functions/ methods: void inpdata() To input 50 integers (no duplicate numbers are to be entered). void bubsort() To sort the array in ascending order using the bubble sort technique and to display the sorted list. void binsearch() To input item and search for it using the binary search technique(using recursion); if found to print the item searched and its position in the sorted list, otherwise to print an appropriate message. Specify the class Sort giving the details of the functions void inpdata(), void bubsort() and void binsearch(). The main function need not be written. Section C [Answer any two questions] Question 9 A superclass Bank has been defined to store the details of a customer. Define a sub-class Account that enables transactions for the customer with the bank. The details of both the classes are given below: [5] Class name: Bank Data members/instance variables: name: stores the name of the customer accno: stores the account number P: stores the principal amount in decimals Member functions/methods: Bank( .): parameterized constructor to assign values to the instance variables void display (): displays the details of the customer Class name: Account Data member/instance variable: amt: stores the transaction amount in decimals Member functions/methods: Account( ): parameterized constructor to assign values to the instance variables of both the classes void deposit(): accepts the amount and updates the principal as p=p+amt void withdraw(): accepts the amount and updates the principal as p=p-amt If the withdrawal amount is more than the principal amount, then display the message INSUFFICIENT BALANCE . If the principal amount after withdrawal is less than 500, then a penalty is imposed by using the formula. p=p-(500-p)/10 void display(): displays the details of the customer Assume that the super class Bank has been defined. Using the concept of Inheritance; specify the class Account giving details of the constructor( ), void deposit(), void withdraw() and void display() The super class and the main function need not be written. Question 10 A bookshelf is designed to store the books in a stack with LIFO(Last In First Out) operation. Define a class Book with the following specifications: [5] Class name: Book Data members/instance variables: name[]: stores the names of the books point: stores the index of the topmost book max: stores the maximum capacity of the bookshelf Methods/Member functions: Book(int cap): constructor to initialise the data members max = cap and point = -1 void tell(): displays the name of the book which was last entered in the shelf. If there is no book left in the shelf, displays the message SHELF EMPTY void add(String v): adds the name of the book to the shelf if possible, otherwise displays the message SHELF FULL void display(): displays all the names of the books available on the shelf Specify the class Book giving the details of ONLY the functions void tell() and void add(String). Assume that the other functions have been defined. The main function need not be written. Question 11 (a) A linked list is formed from the objects of the class Node. The class structure of the Node is given below: [2] class Node { String name; Node next; } Write an Algorithm OR a Method to search for a given name in the linked list. The method of the declaration is given below: boolean search name(Node start, String v) (b) Answer the following questions from the diagram of a Binary Tree given below: (i) Write the in order traversal of the above tree structure. (ii) Name the parent of nodes B and G. (iii) Name the leaves of the right sub-tree. [1] [1] [1]
|