You are on page 1of 4

Kulachi Hansraj Model School

Computer Science (083) Practical File for Class XI (2013-14) Must have minimum 15 programs from the topics covered in class XI course. Configuration of Computer System PowerPoint Presentation sorter dump 6 Programs on Control structures 4 Programs on Array manipulations 4 Programs on String Manipulations 1 Programs on macro 2 Programs on structure manipulations EXTRA Programs

Index for C++ Programming


Name: _____________________________ Section: ___ Roll No.: ____

Last Last Last Last SN. 1.


2.

Date Date Date Date

of of of of

Submission Submission Submission Submission

(Program (Program (Program (Program

No. 1 No. 7 No.11 No.15

6) - 10) 14) 17)

2/09/2013

3.

Program Description Write a program in C++ which accepts temperature in Fahrenheit and converts it into temperature in Celsius. (HINT : C=(F-32)*5/9 ) Write a program in C++ which accepts roll no, marks in 5 subjects from user, calculates total, percentage and prints grade. Grade is given on the bases of following criteria: If percentage >=80 Grade A If percentage <80 and >=60 Grade B If percentage <60 and >=50 Grade C otherwise Grade D Write a menu driven program in C++ which accepts 2 integers and performs one of the five operations as shown in the menu : MAIN MENU 1. ADD 2. SUBTRACT 3. MULTIPLY 4. DIVIDE 5. REMAINDER a) Write a C++ program to generate and print first N terms of the Fibonacci series. Eg. if N=7 OUTPUT : 0 1 1 2 3 5 8 b) Write programs to input the values of x and n and sum up n terms of the following series: 1-

Topic Sequence

Control Structures

SWITCH-CASE

4.

x3 + x5 - x7 . . . 3! 5! 7!

(Any One) Looping Control Structures

#1/4

5.

a) b) c) d) e) f) g) h)

Prime no. check Factors of a number, counting no. of factors and sum of all factors. Check a number for perfect number Check a number for Armstrong number Reverse a given number Factorial of a given number Program which accepts a number in base 10 and prints number in base 2 Checking a number for palindrome

(Any One) Control Structures Looping

6.

WAP to generate n lines of the following patterns on the computer screen: (i) If n is 4, the output is 1 121 12321 1234321 (iii) If n is 7, the output is * * * * * * * * * * * * (ii) If n is 4, the output is ******* ***** *** * (iv) If n is 9, the output is * * * * * * * ********* ******* ***** *** * Control structures Looping

7.

8.

9.

Write a program to read a string and print out the following : 1) No. of capital alphabets, 2) No. of small alphabets, 3) No. of non-alphabets, 4) No. of Words. (Use suitable functions for each operation) Write a program to read a string and print it after replacing each of its capital alphabets by the corresponding small alphabet and each small alphabet by its corresponding capital alphabet and space with # sign Eg.INPUT STRING: Knowledge is tHe Antidote to FEAR. OUTPUT: kNOWLEDGE#IS#ThE#aNTIDOTE#TO#fear. Write a program to input a string. If the string is a palindrome then concatenate Hello Palindrome , otherwise concatenate Hello Non-palindrome with the given string. Then display the resultant string. Eg. if Input string is ARORA Output : Hello Palindrome ARORA If Input string is COMP Output : COMP Not a Palindrome

String manipulation

String Manipulation

String Manipulation

#2/4

10.

Write two User Defined Function void Encode()which accepts a string as its parameter and encodes it. void Decode() which accepts encoded string and decodes it back to original string. Example : INPUT string: This is a COMPUTER World ENCODED string: Uijt jt b DPNQVUFS Xpsme Write menu driven program which gives options for calling both the functions. Write a program in c++ which creates an array of integers and allows user to a. Print the array b. Find Largest c. Find Smallest d. search for a given number e. SUM of all the elements f. Average f all the elements a) Write a program to input n (<=20) integers in an array and then display the array after removing all the duplicate entries from it. Example : for an array with size(n) = 8 Input : 44, 5, 6, 33, 5, 54, 6, 25 Output: 44, 5, 6, 33, 54, 25 b) Write a program which calls upon a function with name void Exchange()in C++ which accepts an integer array and its size as arguments and exchanges the values of first half elements of the array with the second half side of array : Example: If an array of eight elements has initial contents as 2,4,1,6,7,9,23,10 The function should exchange the elements as 7,9,23,10,2,4,1,6

String Manipulation

11.

Array 1-D

12.

(Any one) Array 1-D

13.

14.

Write a program to input the elements in a matrix of size m x n and do the following operations on it: (i) find the row sums (ii) find the column sums (iii) find the diagonal sums (iv) find the transpose (v) display the upper half (vi) display the lower half Write a program to input the morning, noon, and evening temperature for each of the seven days of a week and then display a report showing the following: 1. Maximum and minimum morning temperature 2. Maximum and minimum noon temperature 3. Maximum and minimum evening temperature 4. Average morning temperature 5. Average noon temperature 6. Average evening temperature 7. Average temperature of the week (Use a 2D array)

Array 2-D

Array 2-D

#3/4

15.

16.

17.

18.

19.

Write a menu driven program to use a macro, an inline function, and an outline function to find the square of an integer input from the use. Declare a structure telerec in C++, containing name (20 characters) and telephone number. Write a program which should allow the following: 1) To create an array of telerec type 2) Display the array 3) Search for name for a given telephone number. If the telephone number does not exist then display error message "record not found". Consider a structure : struct length { int feet; int inches; }; Write a program in C++ which uses parameterized UDF length TOTAL_LENGTH(length L1, length L2); to take two lengths (in feet and inches) as parameters and then returns the total length. Write a program to input two numbers n and x and then calculate xn using a function power() with suitable parameters and return data type. If the value of n is not passed to the function, it should calculate x1. Write a function in C++ which accepts an integer array and its size as arguments/parameters and assigns the elements into a two-dimensional array of integers in the following format: If the array is 1, 2, 3, 4, 5, 6 If the array is 1, 2, 3 The resultant 2-D array is: The resultant 2-D array is: 1 2 3 4 5 6 1 2 3 1 2 3 4 5 0 1 2 0 1 2 3 4 0 0 1 0 0 1 2 3 0 0 0 1 2 0 0 0 0 1 0 0 0 0 0 .

Macro

Structure

Structure

EXTRA

EXTRA Data Structures (Arrays)

#4/4

You might also like