0% found this document useful (0 votes)
97 views6 pages

ClassXI Hy2021 Comp - Sc.

The document is a computer science exam question paper containing two parts - Part I with 2 short answer questions and Part II with longer answer questions. Part II is further divided into two sections - Section A with conceptual questions and Section B asking to write Java programs. The questions test concepts like proposition logic, class vs instance variables, binary and hexadecimal conversions, boolean expressions, truth tables, 2D arrays, recursion, Armstrong numbers, common elements between arrays etc. The student is required to attempt the questions within the given time duration of 1 hour 30 minutes.

Uploaded by

subhra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views6 pages

ClassXI Hy2021 Comp - Sc.

The document is a computer science exam question paper containing two parts - Part I with 2 short answer questions and Part II with longer answer questions. Part II is further divided into two sections - Section A with conceptual questions and Section B asking to write Java programs. The questions test concepts like proposition logic, class vs instance variables, binary and hexadecimal conversions, boolean expressions, truth tables, 2D arrays, recursion, Armstrong numbers, common elements between arrays etc. The student is required to attempt the questions within the given time duration of 1 hour 30 minutes.

Uploaded by

subhra
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

SALT LAKE SCHOOL

HALF YEARLY EXAMINATION, AUGUST 2021


CLASS XI Sc.
COMPUTER SCIENCE

TOTAL MARKS: 40 DURATION: 1 HOUR 30 MINS


----------------------------------------------------------------------------------------------------------------

PART I(5 MARKS)


Answer all questions
While answering questions in this Part, indicate briefly your working and reasoning, wherever required.

1. a) What do you mean by consistent statements according to proposition logic? [1]


b) Write one difference between class variable and instance variable. [1]

2. Write the output of the following code snippet if display() method is called with two parameters
whose value is given with the code. Also show detailed dry run. [3]

class Output_xi
{
static void display(int a,int b) // test the code for a=3, b=10
{
int i=3;
for(;i<=b;i+=3)
{
a+=b%i++;
switch(i)
{
case 2: b+=a++ - i++ + a;
case 4:System.out.println(a+b);
case 6: i+=2;
a%=b++/++i;
break;
default:
System.out.println(a+","+b+i);
}
}
System.out.println(a+b+i);
}
}

COMPUTER SCIENCE Page 1 of 6


PART II(15 MARKS)
Section A
Answer question 3 and any one from either question 4 or question 5.

3. Perform the following conversions / operations: (Show detailed working)


a) (A4FED) base 16 - (3FAB) base 16 [2]
b) (477) base 8 = (?) base 16 [2]
c) (1101101.1101) base 2 = (?) base 10 [2]
d) (11011011) base 2 - (101101110) base 2, using 2s complement method. [2]
e) (201.32) base 10 = (?) base 2. [2]

4. a) From the given truth table write the POS expression of X. [2]

A B C X

0 0 0 0

0 0 1 1

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 1

1 1 1 0

b) Reduce the boolean expression to its simplest form: A.(B + C(A.B + A.C)’). Write the laws at each step.
[2]
c) State whether the following proposition is tautology, contradiction or a contingency.
F=(P => Q) V (Q => ~P) [1]

OR

5.a) Verify if the following is valid or not using truth table: (a=>b).(a=>c) = a=>(b.c) [2]
b) Design the circuit to derive NOR gate using NAND gates only. [2]
c) Derive the reduced expression of SUM of Full Adder circuit from its truth table. [1]

COMPUTER SCIENCE Page 2 of 6


Section B(20 MARKS)
Answer any one question from Q6 and Q7 and answer Q8 and Q9.
( Attempt 3 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.

6. Write a program which will accept a 2d array and a number to search. It will print the Sum of the
index(row index + column index) if the number is found both in row and its corresponding column.
[10]
The details of the class are as follows :
Class Name : NumberArray
Instance variable mat[][] : Integer array of size mxn
A number (no ) to search
void accept() : Accept the value of m and n , create the array and accept positive elements in it. It will
also accept the number to search(no)
void display() : Show the 2 d array
int checkRow(int r ) : return the index of the search no in rth row otherwise return -1
int checkCol(int c) : return the index of the search no in cth column otherwise return -1
void showIndex() : Print the sum of index of no in row and column if present otherwise
give a relevant error message
No need to write the main()
Eg
Matrix mat 4578
3674
1615
no= 7
The sum of the index = 2(7 is found in 3rd column ) +1 ( 2nd row of the corresponding column) which
is 3.
OR

7. A palindrome number is one that reads same from left to right or right to left. [10]

Example: 12321, 9834389.

There is an ingenious method to get the palindrome from any positive integer.

The procedure is as follows:

1. Start with any positive number of 2 or more digits.


2. Obtain another positive number by reversing the digits of the starting number.
3. Add the 2 numbers together.

COMPUTER SCIENCE Page 3 of 6


4. Repeat the whole procedure with the sum as the starting number till you get the sum which is the
palindrome number.

Example: start with 87.

1st Step 2nd Step 3rd Step 4th Step

87 165 726 1353

78 561 627 3531

Sum= 165 726 1353 4884

A class Palin is designed to get a palindrome number for a positive number.

Class Palin is defined as follows:

Data member:

int num : to store a positive number having atleast two digits.

Member functions:

void accept() : accepting a number having atleast two digits

int reverse(int) : returns the reverse number

boolean palindrome(int) : used to return true if parameterized value is a palindrome

otherwise return false.

int ingenious( int) :a function that calculates and return the palindrome number

for parameterized number if it is found within 5 steps

otherwise returns -1.

Specify the class, giving details of the functions members along with main method that accept a number
and print its palindrome number by calling above methods. [10]

COMPUTER SCIENCE Page 4 of 6


8. The following program will take a lower range and upper range (assume lower range must be
minimum 3 digit ) and print all the armstrong numbers in the range. [5]
4 4 4 4
Eg of armstrong no. : 1634 = 1 + 6 + 3 + 4 = 1+1296+81+256=1634 (4 digit no)

In the program some codes are missing and they are termed as ?1? , ?2?,?3?,?4?,?5?

Write the required statement(s)


public class ArmStrongNo
{
public void showArmstrong(int l,int h)
{
System.out.println( "Armstrong numbers ");
for(int i=l;i<=h;i++)
{
If ( ?1? )
System.out.println(i);
}
}
boolean isArmStrong(int n)
{
int d=?2? //stores the no. of digits
int cp=n,s=0;
while(?3?)
{
int dg=cp%10;
s= ? 4 ?
cp=cp/10;
}
if(s==n)
return true;
return false;
}
int digitCount(int no)
{
int c=0;
while(no>0)
{
?5?
no=no/10;
}
return c;
}
}

COMPUTER SCIENCE Page 5 of 6


Q9. A class Common has the following data members and methods [5]
Data members - int a[]
int size;
Methods : void accept() : Accept size from user and create an array. Fill the array
Elements. Assume there is no duplicate elements in the array
void showCommonNumbers(Common ob) : Print the common elements
between the current object and the object ob
Write the main() to test the program by creating required objects and calling the
functions

*****************************************************************************

COMPUTER SCIENCE Page 6 of 6

You might also like