|
Computer literacy : An Expertise towards Quality Learning |


|
An Initiative by Dheeraj Mehrotra towards Quality Literacy For All |
|
Towards Quality Computer Literacy For All |

|
|
|
Quality books for Computer Science:
A. A Complete Course in ISC Computer Science (Java) XI –XII B. A Complete Course in CBSE Computer Science (C++) XI– XII C. A Complete Course in ICSE Computer Applications (JAVA) IX—X D. A Complete Course in ICSE Computer Science (C++) IX-X
|
|
IMPORTANT QUESTIONS FOR ISC’ 2009 (XII)
PRACTICAL: COMPUTER SCIENCEPRACTICAL PAPERReading time : 15 mins Planning session : 1 hr Examination session:2 hrs
INSTRUCTIONS
1. Write an algorithm for selected problem 2. Write a program and document your program using mnemonic names and comments.
Test run the program on the computer using the given test data and get the print out in the format specified in the problem along with the program listing. Choose any one question Question 1. Enter the text. Print the text such that the words which have odd number of characters , change the case of the characters which are present in the next word . Input: All that glitters is not gold. Output: all that glitters is nOt gold.
Input: They always talk who never think. Output: They always talk who Never think.
Input: The empty vessels makes the greatest noise. Output: thE Empty vESSElS makEs ThE grEatESt noise.
Question 2. Input N elements in an array. Display its contents . you are required to perform the following task- Print the frequency of each number without repeating the duplicate ones. Delete the numbers such that they exist only once. Arrange the elements such that the largest goes to left , second largest to the right, third largest to the left again and so on
Input dimension of the array : 10 Input elements of the array : 7 3 5 2 6 7 8 8 3 1 Frequency of 8: 2 Frequency of 7: 2 Frequency of 6: 1 Frequency of 5: 1 Frequency of 3: 2 Frequency of 2: 1 Frequency of 1: 1
Contents of array after deletion: 7 3 5 2 6 8 1 Sorted array : 7 5 2 1 3 6 8
Question 3.
Enter the elements in the array of the dimension N. (N should be an odd number). You are required to – 1. Display contents of the array Print the automorphic numbers of the matrix with the row number and column number. Find the square of the number. Extract the number of digits from the end which should be according to the number of digits present in entered number. If the number extracted and entered number are same then the number is automorphic. Eg. Num:25, Square:625 Eg num:6 Square :36
Print the row elements which has maximum automorphic numbers. If the rows have same frequency of automorphics then print the row elements which has larger automorphic number.
Enter N : 3 Elements of matrix : 3 5 82 76 23 384 32 8 6 Automorphic numbers : Number row no. column no. 5 1 2 76 2 1 384 2 3 6 3 3
Row elements: 76 23 384
Enter N: 2 Elements of matrix : 889 2 4 25
Automorphic numbers: Number row no. column no. 889 1 1 25 2 2
Row elements : 889 2
|
|
ISC COMPUTER SCIENCE 2009 (GUESS PAPER) Class XII Paper I (Theory) (Three Hours) Answer all questions in Part I (compulsory) and seven questions from Part II, choosing three questions from Section A and four questions from Section B. 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. While answering questions in this Part, indicate briefly your working and reasoning, wherever required.
Question 1. [5X2=10]
(a) Use the truth table to show that: (A . B + C )+ (A.B)’ =1 [ 2 ] (b) State the two absorption laws. Verify one of them using the truth table [ 2 ] (c) Convert the given function to its equivalent POS form [ 2 ] F(A,B,C) = S (0,2,3,4,6) (d) Convert the following function as a sum of minterms: [ 2 ] F(X, Y, Z) = X.Y + Y’.Z (e) Simplify using laws of Boolean- (P+Q).(P’+Q’).(P’+Q) + P [ 2 ] Question 2. [5X2=10] (a) Define function overloading with an example. [ 2 ] (b) What are adders? Give its utility. [ 2 ] (c). Explain 3 input XNOR gate with the truth table. [ 2 ] (d) Give an application of stack . [ 2 ] (e) An array A[-10…5, 2…8] is stored in the memory with each element requiring 4 bytes of storage. If the base address is 5000, determine the location of A[1][5] when the array is stored row major wise. [2] Question 3. [5X2=10] (a) In the following, function someFn is a part of some class. [5] void somefn()) { for(int i=5;i<9;i++) { m=i; for(j=5;j>1;j-=2) m*=i + j; r=i++ * j; cout<<m<<” “<<” “<<r<<endl; } cout<<i; } (b) The following function is a part of the class Arrange which stores n integers in an array arr[ ]. The member function/ method bubbleSort( ) arranges the array in ascending order. There are five places in the code marked by ?1?, ?2?, ?3?, ?4?, ?5? that must be replaced by expressions or statements so that the program works correctly. void bubbleSort( ) { for (int i=0;i<n;i++) { j=? 1 ? while(j<? 2 ?i) { if(a[j]>?3?) { int val=arr[j]; arr[j]=? 4 ?; arr[j+1]=val; } ? 5 ? } } (i) What is the expression or statement at ?1? [2] (ii) What is the expression or statement at ?2? [2] (iii) What is the expression or statement at ?3? [2] (iv) What is the expression or statement at ?4? [2] (v) What is the expression or statement at ?5? [2]
PART II SECTION A Answer any three questions.
Question 4. [5X2=10] (a) Given the Boolean Function F(A,B,C,D) = S (0,1,2,8,10,11,12,13,14). Use Karnaugh’s map to reduce this function F, using the given SOP form. Draw the logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that variables and their complements are available as inputs. [5] (b) Now given D(A,B,C,D) = p (2, 3, 4, 5,6,7,8, 9, 12, 13). Use Karnaugh’s map to reduce this function D using the given POS form. Draw the logic gate diagram for the reduced POS form. You may use gates with more that two inputs. Assume that variables and their complements are available as inputs. [5] Question 5. [5X2=10] The SOP expression for a combinational circuit that detects an error in the representation of a decimal digit in BCD is given as follows: E(A,B,C, D) = S (10, 11, 12, 13, 14, 15) (a) Use Karnaugh’s map to reduce this function E, using the given SOP form. Draw the logic gate diagram for the reduced SOP form. You may use gates with more than two inputs. Assume that variables and their complements are available as inputs. [5] (b) Now implement E using the NAND gates only. Show how it is equivalent to the original circuit. You may use gates with more than two inputs. Assume that variables and their complements are available as inputs: Question 6. [5X2=10] (a) Draw the logic gate diagram of the given expression using NAND gate only.(A+B’).C [2] (b) What is meant by MULTILEVEL INHERITANCE. [2] (c) What is a Copy constructor. [2] (d) Define decimal to binary Encoder. Explain with diagram [2X2] Question 7. (a) What is a decoder? State any one of its applications. [2] (b) Draw the truth table and logic gate diagram for a 3 to 8 decoder circuit. Show the output at each stage. [6] (c) Find the complement of the expression using DeMorgans Law. {A’ + (B’.C) } . ( A + B ) SECTION B Answer any four 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). Question 8. Define the class sumseries with Data members : int sum , num, X Member functions – sumseries(int, int ) initialize data members . void print () – display sum int factorial(int b) return factorial of b int power(int c) return X ^ c int findsum(int n) – return sum of the given series. ( ^ stands for power and ! for factorial ) 1 - X ^ 1 / !2 + X ^ 2 / !5 - X ^ 3 / ! 8 …….. num terms. Do not write the main function. Question 9. Class MyArray contains an array of dimension N X N where (N<=100). The subscripts of the array elements vary from 0 to n-1. Some of the member functions/ methods of MyArray are given below: Class name: MyArray Data members/ instance variables: arr[][] - an array of integers. N- size of the array. Member functions/ methods: MyArray(int n, int ar[][] ) parameterized constructor to initialize N and arr. void displayArray( ) displays contents of array . Myarray sumMyarray ( Myarray a1) returns Myarray which is sum of Myarray a1 and the current object Also write the main function. Question 10. You are given an array of N integers. A class operation is defined with the following details . class name : operation data members : int array[50] to store maximum 50 elements. int S to store the size of array. Member functions : void read ( ) to accept the size of array and its elements . void pritnarray() to display contents of the array void putinnumber( int n, int p) to insert element at index p. Check the validity of p. int takeout(int p) delete element at p. Return -1 if p is invalid. Do not write the main function Question 11. A set is a collection in which there is no duplication of elements. S = { 1, 6, 9, 24} is a set of 4 integer elements. An array of integers may be used to represent a set. You may assume that there will a maximum of 50 elements in the set. Following are some member functions of the class Set Class name: Set Datamembers/ instance variables: arr- an array of integers to store the elements of the set. n an integer to store the total number of elements in the set. Member functions/ methods: Set(int nn) constructor to initialize n=nn and the array arr void readElements( ) reads the elements of the set void displayElements( ) displays the elements of the set int getSize( ) returns n, the number of elements in the set. int has(int ele) returns 1 if ele belongs to the current set object and 0 otherwise. Set intersection(Set d) returns the intersection of set object d and the current set object i.e. the set containing the elements that are common to both the sets. Set unions (Set d) returns the union of set object d and the current set object i.e. the set containing the elements that are present in both the sets. Specify the class Set giving the details of the functions int has(int ele), Set intersection(Set d), Set union(Set d). You may assume that the other functions/ methods are written for you. You do not need to write the main function. Question 12. A class String1 contains the text and its derived class String2 performs various operations on string handling . class name : String1 Data Members char text[] maximum length 100 characters int len - length of the string Member functions String1() default constructor String1() parameterized constructor void display() to display text and its length derived class name: String2 Data Members: vowels, spaces for counting vowels and spaces Member functions : String2() constructor int countvowel() return no. of vowels int countspaces() return no. of spaces void reverse() to print each word of the text from end. Eg. Sumit and Amit are good boys. Output: boys good are Amit and Sumit. void display() to print the text, reverse of the text, number of spaces and vowels
|
|
Coding a Java Program USING JDK:
The Sun’s Java Development Kit (JDK) provides all the features to write programs. The JDK is available for systems running Windows NT and other versions accordingly.
To type a program, in WINDOWS, the Notepad or DOS editor is employed. A java program has two main parts - a class definition that encloses the entire program and a method called main that contains the body.
Once the program is typed in, it is saved as a file with an extension of Java. Usually, java files have the same name as their class definition.
This file is then compiled using javac. The javac program should be in the execution path for compilation of the Java code.
Once completed , a file by the same name, but with the class extension is created. This is the java bytecode file.
The bytecode is then run using the Java interpreter. In the JDK, the java interpreter is called java.
To execute this, java followed by the file name without the class extension is typed at the DOS prompt. The above compilation and execution procedure works only if Sun’s Java compiler is used.
INPUT/OUTPUT METHODS OF JAVA
The readLine() method is the input statement of Java and println() method displays the output on the screen.
readLine():
The readLine() method or the function is invoked with the usage of an object of the class DataInputStream, and is used to read the input from the keyboard as a string. This entered value is further converted into the corresponding required type using the data type wrapper classes.
Example Program :
// Example program to utilize readLine() method import java.io.DataInputStream; class p4 { public static void main(String args[]) { DataInputStream in = new DataInputStream(System.in); int a=0; int b=0; try { System.out.println(“Enter the value of a”); a=Integer.parseInt(in.readLine()); System.out.println(“Enter the value of b”); b=Integer.parseInt(in.readLine()); System.out.println(“The sum of numbers is “+(a+b)); System.out.println(“The product of numbers is “+(a*b)); } catch (Exception e) {} } }
Output:
Enter the value of a 5 Enter the value of b 5 The sum of numbers is 10 The product of numbers is 25
In the above example program, the readLine() method is invoked with the inclusion of the class DataInputStream. The keywords try and catch is used to handle errors which may be encountered during the entry of the numbers using readLine() method. Read ICSE Comp. Applications by S.Chand & Co. for Details
|
|
EXAMPLE PROGRAM (INPUT BASED) FOR JAVA: // Program to display the name of the week day as per the entered number import java.io.*; // import of all files import java.lang.*; class p4 { public static void main(String args[]) throws IOException { int num=0; InputStreamReader in = new InputStreamReader(System.in); BufferedReader input=new BufferedReader(in); System.out.println(“Enter your choice:”); num = Integer.parseInt(input.readLine()); // converting string to numeric switch(num) {case 1:System.out.println(“The day is Monday”); break; case 2: System.out.println(“The day is Tuesday”); break;
|
|
case 3:System.out.println(“The day is Tuesday”); break; case 4:System.out.println(“The day is Wednesday”); break; case 5:System.out.println(“The day is Thursday”); break; case 6:System.out.println(“The day is Friday”); break; case 7:System.out.println(“The day is Saturday”); break; default: System.out.println(num+”Sorry, this day of the week does not exist”);
} } }
|
bluej - Google Book Searchby DHEERAJ MEHROTRA S. CHAND. More information about BlueJ is available at www. bluej.monash.edu In BlueJ, . .. With BlueJ, one can directly interact with single objects of any class and . Limited preview - About this book - Add to my library. Java: An Eventful Approach - Page 15. by Kim B. Bruce, Andrea Pohoreckyj... |
CBSE Class XII Computer Science Sample Papers for ...Computer Science Sample Paper - By: Mr. Dheeraj Mehrotra. 20 Aug 2007. Download Now Size: 141 KB Total Downloads: 4890. CBSE Latest Sample Question Papers. English. History. Accountancy. Biotechnology. Mathematics. Economics. |
CBSE Class XII Computer Science Sample Papers for ...Computer Science Sample Paper - By: Mr. Dheeraj Mehrotra. 20 Aug 2007. Download Now Size: 141 KB Total Downloads: 4890. CBSE Latest Sample Question Papers. English. History. Accountancy. Biotechnology. Mathematics. Economics. |