0 evaluări0% au considerat acest document util (0 voturi)
706 vizualizări2 pagini
The document contains 20 questions related to computer science topics like arrays, functions, structures, classes, files, sorting, searching, and data structures. The questions involve writing functions to perform operations like merging and sorting arrays, binary search, matrix operations, complex number calculations using structures, employee salary calculation using classes, book record storage using binary files, and stack and queue implementations using arrays and linked lists.
The document contains 20 questions related to computer science topics like arrays, functions, structures, classes, files, sorting, searching, and data structures. The questions involve writing functions to perform operations like merging and sorting arrays, binary search, matrix operations, complex number calculations using structures, employee salary calculation using classes, book record storage using binary files, and stack and queue implementations using arrays and linked lists.
The document contains 20 questions related to computer science topics like arrays, functions, structures, classes, files, sorting, searching, and data structures. The questions involve writing functions to perform operations like merging and sorting arrays, binary search, matrix operations, complex number calculations using structures, employee salary calculation using classes, book record storage using binary files, and stack and queue implementations using arrays and linked lists.
STD XII - Computer Science Record Questions (2014 2015)
1. Given 2 integer arrays A[] and B[] of sizes M and N respectively. Write a function named MIX( ) which will produce a third array named C[], in which the following sequence is followed. All even numbers of A from left to right are copied into C from left to right All odd numbers of A from left to right are copied into C from right to left All even numbers of B from left to right are copied into C from left to right All odd numbers of B from left to right are copied into C from right to left A, B and C are passed as arguments to MIX( ). Eg: A is {3,2,1,7,6,3}and B is {9,3,5,6,2,8,10} c is {2,6,6,2,8,5,10,3,9,3,7,1,3}
2. Suppose A[], B[], C[] are integer array of integers of size M, N and M+N respectively. The numbers in array A and B should be arranged in ascending order using insertion sort. Also write a function MERGE( )to produce the third array C by merging arrays A and B in descending order using merge sort. Pass the array A, B and C as arguments in the function.
3. Suppose an array P containing N integer values are arranged in ascending order using selection sort. Write a user defined function to search for a integer from P with the help of binary search method. The function should return an integer 0 to show absence of the number and integer 1 to show presence of the number in the array. The function should have 3 parameters i. an array P ii. The number DATA to be searched iii. Number of elements N
4. Write a function that accepts a 2D int array in the size of M rows, N columns and print the alternate numbers in the given format with its row sum. For example: If the original matrix is 1 2 3 4 5 1 3 5 Sum=9 6 7 8 9 10 output should be 7 9 Sum=16 11 12 13 14 15 11 13 15 Sum=39 16 17 18 19 20 17 19 Sum=36
5. Write a program using function called FIND_SUM_PRODUCT ( ) that accept a 2D int array and its size as argument find and print the sum and product of each row and each column.
6. A library maintains some records with the following record structure: book number, title, author, no. of copies and price. Write a complete program using structure and do the following a. Input N records b. Display all the records c. Given the author name, display the book no, title, author, no of copies and price of all books.
7. WAP to find the sum and difference of two complex numbers using functions SUM( ) and DIFF( ) that accepts two complex numbers as arguments and return the result using structure.(return type of the function is structure)
8. Write a C++program using classes and objects to simulate the salary sheet representation of N employees. For each employee the data members are - name, age, salary, HRA, DA and PF(use getvalue( ) member function.) Compute the gross salary of each employee using gross salary =salary+hra+da and also compute the net salary by deducting tax and pf as shown below using compute ( ) member function and print the name, salary of each employee using prnresult() member function. Initialize the name as null and other data members as zero using constructors. Salary Tax <=10000 2% of gross salary >10000 & <=50000 5% of gross salary >50000 10% of gross salary
9. Define a class Travel in C++with the following descriptions: Private Members TravelCode of type long Place of type character array(string) Season of type character array(string) Total_fare of type float Discount of type float Public Members: A constructor to assign initial values to TravelCode as 0, place as NULL, Season as General , Total_fare =0 , Discount =0. A function NewTravel() which allows user to enter TravelCode, Place, Season and Total_fare. Also calculates the Discount as per the following conditions: Season Discount (%) Diwali 10 Holi 5 Christmas 15 Summer 20 General 0 Discount given on Total_fare A function ShowTravel() to display all data members on screen.
10. Write definitions for two versions of an overloaded function. This functions1 st version sum( ) takes an argument, as int array, array size and returns the sum of all the elements of the passed array. The 2 nd version of sum( ) takes two arguments, an int array, array size and a character (E or O). If the passed character is E, it returns the sum of even elements of the passed array and if the passed character is O, it returns the sum of odd elements. In case of any other character, it returns 0 (zero). Main program should accept a choice from the user and perform the following menu. i. Sum of all numbers ii. Sum of even numbers iii. Sum of odd numbers.
11. Imagine a publishing company markets both books and audio cassette versions of its works. Create a class publication that stores the title and price of a publication. From this class derive two classes: class book, which adds a page count and class tape, which adds a playing time in minutes. Each of these three classes should have a getdata( ) function to get its data from the user and a putdata( ) function to display it. Write a main ( ) program to execute the book and tape classes by creating instances of them and ask the user to fill in their data with getdata( ) and then display the data with putdata( ).
12. WAP to create a text file called story.txt, store information line by line, read the same from the file and count and print the following: No. of lines, No. of words(each word ends with blank space or .), No. of alphabets, no of digits, no of special characters, and blank spaces. (Maximum length of the line is 80 characters)
13. Write a C++program to create a text file called school.txt, store information about c.v and then display the file. Create another text file called newschool.txt convert uppercase letters into lowercase letters and vice versa and store it in the new file called newschool.txt and Display the newly created file.
14. Following is the structure of each record in a binary file named player.dat. struct player {int pcode; char pna[25], game[15],coun[25]; }; Write functions for the following i. function to create a file ii. Function to search and modify the existing player record by player code iii. Function to display all the records. (To modify, the value of the players code, player name, game and country are read during the execution of the program)
. 15. Following is the record structure of the binary file Books.dat. class BOOK { int bcode; char title[20]; char subject[15]; float price; public: void InputBook( ){ cout<<Enter book code, title, subject and price; cin>>bcode>>title>>subjec>>price;} void ShowBook( ) {cout<<bcode<< <<title<< <<subject<< <<price<<endl;} int RetBookCode() { return bcode; } char *RetSubject( ) { return(subject); } }; Using given class, write functions i. To create a file and store few records ii. Function to search records on given subject and display all matching records iii. Function to read the objects of books from the binary file Books.dat and display all the objects where book code is from 1001 to 1007
16. Write a program for stack operations to store, delete and display characters using arrays. 17. Write a program using queue to store, delete and display integer numbers using array. 18. Write a program using circular queue to store, delete and display integer numbers using array. 19. Write a program to Add, delete and display an integer using linked list for stack operation. 20. Write a program to store, read, and display inter values using linked list for Queue operations.