Saturday, February 18, 2017

Sample paper 6 for ICSE computer Application class X


Sample paper 6 for ICSE computer Application



SUB: COMPUTER             FOR CLASS X                                   MARKS: 100
__________________________________________________________________
This paper is divided into two sections. You are to answer all the questions from section A, and any four from section B.
Section A(40 marks)
Attempt all questions
Question 1.                                                                                                                           [2X5=10]
a.What is function overloading? Explain with example.
b. Name the primitive data type in Java that is:
1.A 64 bit integer used when you need a range of values wider than those provided by int.
2.A single 16-bit Unicode character whose default value is ‘\u0000’.
c.    Define Polymorphism.
d.   double b=-65.3;
double a= Math.rint(Math.abs(b));
System.out.println(" a = "+ a);
e.         What is the difference between a static member functions & function which are not static?
Question 2.                                                                                                                           [2X5=10]
a.      Write statements for the following
1.         To create an object of class Teacher with default constructor.
2.         To invoke a method of class Teacher i.e Make_Result(int x)
b.      What is the difference between a constant and a variable?                        
c.       What is a package? Give name of any two packages.                                  
d.      What do you mean by type conversion? How is implicit conversion different fromexplicit conversion?                      
e.      State the difference between while loop and do while loop.
Question 3.                                                                                                                           [2X5=10]       
a. What will be the output when the following code segments are executed?
1.      String s=”1001”;
                                                              i.      Int x=Integer.valueOf(s);
double y=Double.valueOf(s); System.out.println(“x=+x); System.out.println(“y=+y);
2.  System.out.println(“The king said \Begin at the beginning ! \to me.”);

b.      Consider the following code.
Public class Student
           {
Public static int x=3,y=4;
Public int a=2,b=3;
           }
1.            Name the variables for which each object of the class will have its own distinct copy.
2.             Name the variables that are common to all objects of the class.

c.    In the program given below, state the name and value of the
1.      Method argument or argument variable
2.  class variable
3.      local variable
4.      instance variable
class myClass
{         static int x= 7; int y=2;
public static void main(String args[])
{
myClassobj = new myClass();
System.out.println(x);
obj.sampleMethod(5);
int a=6;
System.out.println(a);
}
void sampleMethod(int  n)
{           System.out.println(n); System.out.println(y);
}
}
d. What will be the result stored in x after evaluating the following expression?
int x=12;
x+=(x++) + 4 + ( --x);
e. Give one example each of a primitive data type and a composite data type.
                   
Question 4.                                                                                                                           [2X5=10]
a)      Whatisthedatatypereturnedbythelibraryfunctions:
1.      compareTo()
2.      equals()                                                                                                                      
b)      Write the Java expressions for:         
A2 + B3
c)       
1. Name the package that contains Scanner class.
2. Which unit of the class gets called, when the object of the class is created?
d)      What is the role of keyword void in declaring functions?
e)    What is a token? Name any two of them.



Section B

Attempt any 4 questions from this section. Each program should be written using a variable list so that the logic of the program is clearlydepicted.


Question 5.                                                                                                                                                  
a.    Write a class fact which takes integer number and check whether it is Automorphic number or not.
An automorphic number is the number which is contained in the last digit(s) of its square.
Example 25 is an automorphic number as its square is 625 and 25 is present as thelast two digits.                                                                                                                                                 [ 7 ]
b.    Create a class to take an integer number and check if it is a palindrome number of not.                 
A palindrome number is a number when reversed also the number remains the same.
Example: 121 is a palindrome number.                                                                                         [ 8 ]

Question 6.                                                                                                                                       [15]
Define a class student as described below:
Datamembers/instancevariables:
Name,age,m1, m2,m3 (marks in 3 subjects), maximum, average
Membermethods:
i)        A parameterized constructor to initialize the data members
ii)       To accept the details of a student.                     
iii)      To compute the average and the maximum out of three marks
iv)      To display the name, age, marks in three subjects, maximum and average.

Question 7.                                                                                                                                     [15]

Write a program to input any given string to calculate the total number of characters and vowels
present in the string and also reverse the string.
Example   :
INPUT
Enter String                                         :  SNOWY
OUTPUT
Total number of characters                :  O5
Number of Vowels                              :  01
Reverse string                                     : YWONS       





Question 8.                                                                                                                                   [15]
Design a class to overload a function polygon( ) as follows: 
i) void polygon(int n, char ch) with one integer argument and one character type argument that draws a filled square of side n using the character stored in ch.
ii) void polygon(int x, int y)   with two integer arguments that draws a filled rectangle of length x and breadth y, using the symbol @
iii) void polygon() with no argument that draws a filled triangle below.    
Example :
i)              Input value of n=2. Ch=’O’  
Output:
OO 
OO 

ii)             Input value of x=2, y=5
Output:
@@@@@  
@@@@@ 

iii)
Output:  
** 
***
                                                                                               
Question 9.                                                                                                                                       [15]
Write a menu driven program to find the sum of the following series depending on the user choosing
1 or 2
1. S=1/4+1/8+1/12.........+1/n (value of n will be given by the user)
2. S=1/x1+2/x2+3/x3.......+n/xn(value of x and n will be given by the user)
                       

Question 10.                                                                                                                      [15]

Write a program to input and store any ten numbers given by the user in an integer array. Sort and display them in ascending order using any sorting technique (Bubble sort or selection sort).                                                                                                                       

ISC computer Science class XII Sample paper 3

ISC computer science class XII sample paper 3


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

Answer all questions

Question 1.                                                                                                                                         [1X5=5]
A) Write the truth table for a 2 input disjunction in a propositional logic.
B) Using a truth table verify the following expression: (X+Y). Z=/=(Z.X)+Y
C) Find the complement of X.(Y.Z’+ Y’X) using De Morgan’s law. Do not reduce the expression.  
D) State and verify the Distributive law using the truth table.
E) Reduce the following expression to its simplest form using law of Boolean algebra. At each step clearly state the law used for simplification.  C.D’ +A +A+C’D’+A.B
Question 2.                                                                                                                                      [2 x 5 =10]
a)    What is the use of implements keyword?
b)    Convert the following infix notation to postfix:
            p+q*r- s/t
c)    State the differences between throw and throws keyword?
d)    A matrix of 2D array defined as A[4,….7][-1….3] requires 2 bytes of storage space for each element. Calculate the address of x [6,2], if x [0] [0] is stored in location 100 in the row major order.
e)    What is the difference between the best case and worst case complexity of an algorithm?
                                                                                                                                               
Question3.
The following function month() is a part of a class. What will be the output of the following function month() when the value of n is ‘January ‘ and the value of R is 5?  Show the dry run/working.
void month(String n, int R)
{
If(R<0)
System.out.print(“  “);
else
{
System.out.println (n.charAt(R) +” .”);
month(n, R-1);
}
}

Part II
Answer six questions in this part, choosing two questions from Section A, two from Section B and twofrom Section C.
Section A
Answer any two questions
Question 4.
a) Given F(P,Q,R,S)= Σ(0,1,2,3,5,7,8,9,10,11)
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups( i.e. octal, quads and pairs).                                                                                                                                    [4]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables andtheir complements are available as inputs.                                                                                                      [1]

b) Given P(A,B,C,D)= ABC’D’ + A’BC’D’+ A’BC’D+ ABC’D+A’BCD+ABCD
i) Reduce the above expression by using 4 variable Karnaugh map, showing the various groups (i.e. octal, quads and pairs).                                                                                                                                   [4]
ii) Draw the logic gate diagram for the reduced expression. Assume that the variables and theircomplements are available as inputs.                                                                                              [1]

Question 5
a) Draw the truth table and logic circuit diagram for a 3X 8 decoder.                                                    [5]
b) What do you understand by a multiplexer? State any one application of a multiplexer circuit.    [2]
c) Draw the logic gate diagram to implement the AND gate by using NOR gate and NAND gate.  [3]

Question 6.
a)  Draw a logic diagram for the following function using only NAND gate.                                        [3]
F(A, B, C, D)=(A’+B’). (B+C’)(C’+A)
b)  A combinational logic circuit with three inputs P, Q, R produces output 1 if there are odd number of 0’s as inputs.                                                                                                                                            [5]
1.    Draw its truth table and write its SOP expression.
2.    Find the complement of the above derived expression using De Morgan’s theorem.
c)    What is an abstract class?                                                                                                                      [2]
                                                                                                     

Section B
Answer 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.                                                                                                                                                    [ 10 ]

A class RecFact defines a recursive function to find the factorial of a number.
The details of the class are given below:
Class name
RecFact
Data members

n
stores the number whose factorial is required.

r
 
stores an integer
Member functions

RecFact( )
default constructor
void readnum( )
to enter values for ‘n’ and ‘r’
int factorial(int)
returns the factorial of the number using the Recursive     Technique.
void factseries( )
to calculate and display the value of

     n! +(r-2)!
_     (n - r) !
Specify the class RecFact giving the details of the constructor and member functions void readnum( ), int factorial(int) and void factseries( ). Also define the main function to create an object and call methods accordingly to enable the task.

Question8.
A Transpose of any array is obtained by interchanging the elements of the rows and columns.
A class Transarray contains a two dimensional integer array of order [ m x n]. The maximum value possible for both ‘m’ and ‘n’ is 20. Design a class Transarray to find the transpose of a given matrix. The details of the members of the class are given below :
Class name                                          :           Transarray
Data members           
arr[][]                                                  :           stores the matrix elements
m                                                         :           integer to store the number of rows
n                                                          :           integer to store the number of columns
Member functions      :
Transarray()                                        :           default constructor
Transarray(int mm, int nn)                 :           to initialize the size of the matrix, m=mm, n=nn
void fillaray()                                      :           to enter the elements of the matrix
void transpose(Transarray A)             :           to find the transpose of a given matrix
void disparray()                                   :           displays the array in a matrix form
Specify the class Transarray giving the details of the constructor and other member functions. You need not to write the main function.                                                                                                 [10]


Question 9.

Class ChaArray contains an array of n characters (n<=100). You may assume that the array contains only the letters of the English alphabet. Some of the member functions/methods of ChaArray are given below:
Class Name                                                                        ChaArray
Data Members/instance variables :
char ch[]                                                                              : An array of characters
int size                                                                              : The size of array of characters
Member functions/methods:
ChaArray()                                                                          : Constructor to assign to initialize instance  variables to null.
ChaArray(char c[])                                                           : Constructor to assign character array c to  the instance variable.                
void displayArray()                                                          : to display the list of n characters.
void move()                                                                  : to move all the upper case letters to the right side of the array and       the lower case   letters to the left side of the array without   using any standard sorting technique.
                                                                                        Example:
  Input: t D f s X v d
  Output: t d f s v X D
Specify the class ChaArray giving the details of the two constructors and the functions void displayArray(), and void move() only. You do not need to write the main function.
[10]

Section C
Answer any two questions

Each program should be written in such a way that it clearly depicts the logic of the problem step wise.This can also be achieved by using comments in the program and mnemonic names or pseudo codes foralgorithms. The program must be written in Java and the algorithms must be written in general/standard form, wherever required/ specified. (Flowcharts are not required.)


Question 10.
A consumer wants to computerized his electricity bill calculations for his/her own purpose. There is class meter which contains meter details and another class ElectricityBill which calculates the bill amount. The details of both the classes are as given below:
Class name                             :           Meter
Data members                       :
            meternum                    :           long integer data to store meter number.
            name                            :           string data to store name of consumer.
            mcharge                       :           double type data to store meter rental charges.
            prRead                        :           long integer data to store previous meter reading.
Member functions                 :
            Meter(long m, double ch, long p)       :           a constructor to assign m to meternum, ch to mcharge
                                                                                    and p to prRread.
            void readname()                                  :           to accept name of consumer.
Class name                             :           ElectricityBill
Data members                       :
            crRead                         :           long integer data to store current meter reading.
            rate                              :           stores rate per unit.
            units                            :           stores total units consumed
            amt                              :           stores total bill amount
Member functions                 :
            ElectricityBill(……..) :           constructor to initialize the data members and assign 3.50 to rate.
            double calculations()   :           to find total units consumed and returns the bill amount (units * rate
per unit) to be paid by the consumer.
            void dispBill()             :           to display electricity bill in the following format

Meter              Name  Rental             Previous         Current          Rate                Total               Bill
Number                      Charge           Reading          Reading          Per Unit          Units               Amount
                                                                                                                                                            [5]

Question 11.
Link is an entity which can hold a maximum of 100 integers. Link enables to add elements from the rear end and remove integers from the front end of the entity. Define a class Link with the following details:
Class name                             Link
Data members
lnk[]                                         entity to hold the integer elements.
max                                         stores the maximum capacity of the entity.
begin                                       to point to the index of the front end.
end                                          to point to the index of the rear end.
Member functions
Link(int nn)                              constructor to initialize max=mm, begin=0, end=0.
void addLink(int v)                  to add an element from the rear index if possible otherwise display
                                                the message “OUT OF SIZE”.
int dellink()                              to remove and return an element from the front index, if possible
                                                Otherwise display the message “EMPTY…” and return -99.
void display()               displays the elements of the entity.
Specify the class Link giving details of all the functions.                                                                               [5]
                                                                                                                       






Question 12.

A)A Linked List is formed from the objects of the class,                                                                                [2]

Class Node

{

Int num;


Node next;

}

Write the algorithm OR a method for inserting a node in the end of the list.

The method declaration is given below:

Void insertnode(node start, int x)                                                                                          

b) Answer the following questions from the diagram of a binary tree given below:-
List the nodes in the tree given below using:
                                                                                                  [3]

(i)        Preorder Traversal

(ii)       Postorder Traversal

(iii)      Inorder traversal



F



H

G

                             J                         P                                 M
                            I
                                                                                       
K                L                                              O                   N