Programming Test

2
Jawahar Navodaya Vidyalaya, Davanagere Programming Revision Test – 1 Class: XII Max Marks: 35 1. Assuming that there are 7.481 gallons in a cubic foot, write a program that asks the user to enter the number of gallons, and then display the equivalent in cubic feet. 3 2. Write a single cout statement to display the following output: 2 Program = 20 Documentation = 23 Logic = 21 Flow chart = 18 3. Write a C++ program to accept two integers and print their sum. 2 4. Write a program to find whether a given number is even or odd. 3 5. Write a C++ program to input choice (1 or 2). If choice is 1, print the area of a circle otherwise print the perimeter of circle. Accept the radius of circle from user. 4 6. Write a program to produce the following design: 4 & & & & & & & & & & & & & & & & & & & & 7. Write a C++ program that invokes a function calc() which intakes

Transcript of Programming Test

Page 1: Programming Test

Jawahar Navodaya Vidyalaya, Davanagere

Programming Revision Test – 1Class: XII Max Marks: 35

1. Assuming that there are 7.481 gallons in a cubic foot, write a program that asks the user to

enter the number of gallons, and then display the equivalent in cubic feet. 3

2. Write a single cout statement to display the following output: 2

Program = 20

Documentation = 23

Logic = 21

Flow chart = 18

3. Write a C++ program to accept two integers and print their sum. 2

4. Write a program to find whether a given number is even or odd. 3

5. Write a C++ program to input choice (1 or 2). If choice is 1, print the area of a circle

otherwise print the perimeter of circle. Accept the radius of circle from user. 4

6. Write a program to produce the following design: 4

&

& &

& &

& &

& &

& & & & & & & & & & &

7. Write a C++ program that invokes a function calc() which intakes two integers and an

arithmetic operator and prints the corresponding result. 6

8. Write a short program that reads two matrices X[3][3] and Y[3][3] and prints the sum of

them. 5

9. Distinguish between the following functions: 2

islower() and tolower()

isupper() and toupper()

10. Write a program that reads a string and a character. Each occurrence of the given character

(regardless of its case) is converted to opposite case. For example, if the string entered is:

AabrAcadabrA and the character as A or a then the output string should be aAbracAdAbra. See each

a or A is converted to opposite case i.e., upper to lower or vice-versa. 4

********************* ALL THE BEST *********************