Formatting page ...
Amarjyoti Saraswati International School 1st preliminary examination Sub: - Computer Science Paper 1 STD: XII Marks: - 70 Date: /12/2024 Time: 3 Hrs. (Candidates are allowed additional 15 minutes for only reading the paper. They must NOT start writing during this time.) Answer all questions in Part I (compulsory) and seven questions from Part-II, choosing TWO questions from Section A, two from Section-B and two from Section-C. All working including rough work, should be done on the same sheet as the rest of the answer. The intended marks for questions or parts of questions are given in brackets [ ]. PART I Attempt all questions While answering questions in this Part, indicate briefly your working and reasoning, wherever required. Question 1. (a) (b) (c) (d) (e) (f) (g) (h) (i) (j) The dual of ( P + P' ) ( Q + 0 ) = Q is: (a) P.P + Q.1 = Q (b) P.P + Q.0 = Q (c) P.P + Q.1 = Q (d) P+P + Q+1 = Q If ( x => ~y ) then, its inverse will be: (a) x => y (b) y => x (c) ~y => x (d) ~x => y Name the condition when the user tries to delete the element from an empty stack. (a) Underflow (b) Garbage Collection (c) Overflow (d) None of these Find Maxterm designation of (A BC ) Explain the concept of pass by reference with an example. Pass by reference is done using which type of data ? Which keyword is used to inherit an interface ? Expand the terms : LIFO and FIFO Give an example to demonstrate the use of this keyword. What type of data is returned by the method toUpperCase() ? [1] [1] [1] [1] [1] [1] [1] [1] [1] [1] Question 2. (a) Name and draw the logic gate represented by the following truth table, where A and B are inputs and X is the output. [2] (b) (c) (d) (i) (ii) A B X 0 0 0 0 1 1 1 0 1 1 1 0 Convert the given infix expression to postfix: ((A-B)*(D/E))/(F*G*H) [2] Differentiate between method overloading and method overriding. [2] The following function word( ) is part of some class. Study the definitions and answer the questions that follow. [4] public void word( String in, int p) { if(p<in.length( ) ) { word(in, p+1); System.out.print(in.charAt(p)); } } What will the function word( String in, int p) return if str= NIHALAM and p=0? What will the function word( String in, int p) return if str= AYESHA and p=5? State in one line what the function word( String in, int p) is doing apart from recursion? Part II Answer seven questions in this part, choosing TWO questions from Section A, TWO from Section B and TWO from section C. SECTION A Answer any three questions. Question 3. (a) Consider the two propositions , [2] (i) o= OMJ eat BADAM. (ii) m = His mind will run like a horse. Construct the Contrapositive , Inverse and Converse statements for the expression: o m (b) Convert the following infix notation into its postfix form: [2] A + (( B+ C) + ( D + E) * F ) / G (c) How is a decoder different from a multiplexer? Write the truth table and draw the logic circuit diagram for a 3 to 8 decoder and explain its working. [2] (d) From the logic circuit diagram given below, derive the Boolean expression and simplify it to show that it represents a logic gate. Name and draw the logic gate. [2] (e) Using a truth table, state whether the following proposition is a Tautology, Contradiction or Contingency: Question 4. (a) In the following truth table x and y are inputs and B and D are outputs: INPUT OUTPUT XY BD 00 00 01 11 10 01 11 00 (b) (c) [2] [3] Answer the following questions: i) Write the SOP expression for D. ii) Write the POS expression for B. iii) Draw the logic diagram for the SOP expression derived for D, using only NAND gates. Using a truth table, verify if the following proposition is valid or invalid: [3] (A B) ^ (B C) = (A C) From the logic circuit diagram given below, name the outputs (1), (2) and (3). Finally derive the Boolean expression and simplify it to show that it represents a logic gate. Name and draw the logic gate. [4] Question 5 (a) The owner of a company pays bonus to his salesmen as per the criteria given below: work on off days/holidays. OR salesman works when festival sales are on and updates showroomarrangements. OR (b) (c) 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.) 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 POS expression for X(O,F,H,U). What is a half adder? Write the truth table and derive an SOP expression for Sum and carry for a half adder. Write the complement of the following expression ( X + Z ) . ( X.Y + Y.Z ) + X.Z + Y [5] [3] [2] SECTION B Answer any two questions 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 and comments in the program. (Flowcharts and Algorithms are not required ) The programs must be written in Java Question 7 A class Combine contains an array of integers which combines two arrays into a single array including the duplicate elements, if any, and sorts the combined array. Some of the members of the class are given below: Class Name : Combine Data members com[ ] : integer array size : size of the array Member functions/methods Combine(intnn) : parameterized constructor to assign size = nn Void inputarray( ) : to accept the array elements void sort() : sorts the elements of combined array in ascending order using the selection sort technique. void mix(Combine A, Combine B) : combines the parameterized object arrays and stores the result in the current object array along with the duplicate elements , if any. void display( ) : displays the array elements. Specify the class Combine giving details of the constructor(int ), void inputarray( ), void sort(), void mix(Combine, Combine) and void display( ). Also define the main function to create an object and call the methods accordingly to enable the task. Question 8. Design a class VowelWord to accept a sentence and calculate the frequency of words that begin with A vowel. The words in the input string are separated by a single blank space and terminated by a full stop. The description of the class is given below: Class Name : VowelWord Data members str : to store a sentence freq : to store the frequency of words beginning with a vowel. Member functions VowelWord() : constructor to initialize data members to legal initial values. Void readstr() : to accept a sentence. Voidfreq_vowel( ) : counts the frequency of the words beginning with a vowel. void display() : to display the original string and the frequency of the words that begin with a vowel. Specify the class VowelWord giving details of the constructor( ), void readstr(), void freq_vowel() andvoid display(). Also defing the main function to create an object and call the methods accordingly toenable the task. Question 9 Define a class to implement the class diagram given below : Class : Number Data members Int n Methods : Number() Default constructor. Number(int ) parameterized constructor to update n. Booean isPalindrome() To check whether the given number is palindrome or not. Boolean isPatrick() To check whether the given number is a Patrick number or not. A Patrick number falls in the range between 100 and 9999 and having first and last digits identical. E.g. 202 , 444 , 909 SECTION C Answer any two questions Each Program / Algorithm should be written in such a way that it clearly depicts the logic of the problem step wise. This can be achieved by using pseudo codes: (Flowcharts are not required) Programs to be written in Java. The Algorithm must be written in general/standard form. Question 10. A super class Record contains names and marks of the students in two different single dimensional arrays. Define a sub class Highest to display the names of the students obtaining the highest mark. The details of the members of both the classes are given below: [5] Class name : Record Data member/instance variable: n[ ] : array to store names m[ ] : array to store marks size : to store the number of students Member functions/methods: Record(int cap) : parameterized constructor to initialize the data member size = cap void readarray() : to enter elements in both the arrays void display( ) : Class name: Data member/instance variable: ind Member functions/methods: Highest( ) displays the array elements Highest : parameterized constructor to initialize the data members of both the classes void find( ) : finds the index of the student obtaining the highest mark and assign it to ind void display( ) : displays the array elements along with the names and marks of the students who have obtained the highest mark Assume that the super class Record has been defined. Using the concept of inheritance, specify the class Highest giving the details of the constructor( ),void find( ) and void display( ). Question - 11 : to store the index Question 12 Write a recursive method to print the first 10 multiples of 7 in reverse order. SYMPATHY you can get at any time anywhere, but JEALOUCY you have to EARN !
|