Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

KERALA PUBLICSCHOOLS

Academic Session 2023-24

KEALAPULI1C SCiS FinalTerm Unit Test | Total Marks: 40

STD - XI SUB: COMPUTER SCIENCE DATE: 29.11.23


(Attempt all the questions)
Question 1.
Multiple choice questions:
1) The law which states a+ (b.c)=(a+b).(a+c) is :
(1]
(a) Associatative Law (b) Distributed Law (c) Involution Law (d) Commutative Law
2) Assertion (A): Contingency is a combination of tautology and contradiction. When a propositional
statement is concluded into False as well as True for different values of the variables, it is said to be
contingency.
Reason (R) : In the truth table, the outcome of a^(avb) has a combination of Os and 1s both.
Based on the above discussion, choose an appropriate statement from the options given belOw:
(1]
(a) Both Assertion (A) and Reason (R) are true and Reason (R) is correct explanation of Assertion (A).
(b) Both Assertion (A) and Reason (R)are true and Reason (R) is not a correct explanation of Assertion
(A).
(c) Assertion (A) is false and Reason (R) is true.
(d) Assertion (A) is true and Reason (R) is false.

3) Which is the correct statement for half adder (1]


(a) AB (b) A B' + A' B (c) Both Aand B (d) None of these

4) Which is the incorrect statement while defining the variable name? [1]
(a) It can begin with an alphabet using underscore () in between them.
(b) It must begin with a percentage sign (%).
(c) No spaces are allowed in variables.
(d) It cannot be a reserved word.

5) Given: if p: You study well. [1]


Q: Youwill succeed.
Then p-> represents:
(a) p' conjunction 'q'
(b) p'disjunction 'q'
(c) 'p' negation 'q
(d) 'p' implies 'q'

6) Define the term fall through condition with reference to switch () case.
[1]
7) What is the difference between charAt() and indexOf() function ?
[1]
8) What is an array?
[1]

Question 2.
(a) Using truth table, prove the p =>q is equivalent to ~q=>p. (2 x 4 = 8]
(b) Drawthe logic circuit diagram: A(B +C)
(c) Define tautologies and
(d) Define Truth Table.
contradictions.
Question 5.
Define a class MatRevto reverse each element of a matrix.
(8)
For example:
72 371 5 27 173 5
12 6 426 21 6 624
5 123 94 5 321 49
Some of the members of the class are given below:
class name MatRev
Data members/Instance variables
ar) :to store integer elements
m :to store number of rows
n :to store number of columns
Member Method/Member Functions
matrev(int mm, int nn) : parameterised constructor to initialise the data members m=mm and n=nn
int reverse(int x) : returns the reverse of the number x
void assign() : to assignthe reverse number in the new array
void show( ) : displays the matrix.

Define the class MatRev giving the details of the construcotr( ), int reverse(int) and show(). Define the main ()
function to create an object and call the functions accordingly to enable the task.

Question 6. [8]
Define aclass Encrypt to replace only the vowels in a word by next corresponding vowel and forms a
new word. Example: Input : COMPUTER
Output: CUMPATIR
Class name :Encrypt
Data member/instance variables:
wrd : to store a word
len : integer to store the length of the word
newwrd : to store the crypted word
Member functions/methods:
Encrypt () default constructor to initialize data members with legal initial values.
void acceptword() to accept aword in UPPER CASE.
finds the frequency of the vowels and consonants in the word stored in 'wrd' and
void freqvowcon()
displays
them with an appropriate message.
void nextvowel() :replaces only the vowels from the word stored in 'wrd' by the next corresponding
Vowel
from the word stored in 'wrd' by the next corresponding vowel and assigns it to
'newwrd',
withthe remaining alphabets unchanged.
void disp() : display the original word along with the encrypted word.

Specify the class encrypt giving details of the constructor(), void acceptword), void freqvowcont(), void
nextvowel() and void disp(). Define main() function to create an object and callthe functions accordingly to
enable the task.

Question 7. [8]
Define the class BinSearch having the following description:
Class name BinSearch
Data Members:
arrl] : tostore integer elements.
n
: integer tostore the size of the array
Member Methods:
BinSearch() :parameterized constructor to initialize array and another variable with default value;
void fillarray() : toenter elements in the array in ascending order, enter a number vfor searching
Int bin_search(int I, int u, int v) : searches for the value v using binary search technique and returns its
location if found otherwise return -1.
Void display( ):to display the appropriate message .

Define the class BinSearch giving details of the constructor (0, void fillarray () and int bin _search (int, int, int).
define the main() function to create object andcall the functions accordingly toenable the task.

You might also like