0% found this document useful (0 votes)
11 views5 pages

C++ Class 12 Practical Exam Paper

This document is help full

Uploaded by

siqbal445533
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

C++ Class 12 Practical Exam Paper

This document is help full

Uploaded by

siqbal445533
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

💻 C++ Practical Paper for Class 12

Total Marks: 40
Time Allowed: 1 Hour 30 Minutes

🧠 Section A — Multiple Choice Questions (1 mark each)

(Choose the correct option)

1. Which of the following is a valid C++ comment?


a) // comment
b) # comment
c) -- comment
d) /*# comment*/

2. Which header file is required for using cout and cin?


a) <stdio.h>
b) <iostream>
c) <fstream>
d) <conio.h>

3. C++ is an extension of which programming language?


a) Java
b) Python
c) C
d) Pascal

4. What is the output of the following code?

int x = 5;

cout << x++ << " " << ++x;

a) 5 7

b) 6 6

c) 5 6

d) 6 7
5. Which of the following is not a valid data type in C++?
a) int
b) real
c) char
d) float

6. What will be the output of this statement if a=10, b=4?

cout << a / b;

a) 2
b) 2.5
c) 2.0
d) 2.25

7. The process of hiding data and showing only essential information is called:
a) Abstraction
b) Encapsulation
c) Inheritance
d) Polymorphism

8. Which operator is used to access class members through an object?


a) *
b) .
c) ->
d) &

9. Which of the following defines a constant in C++?


a) int const a = 10;
b) constant int a = 10;
c) a = constant 10;
d) define a = 10;

10. What is the default value of a local variable?


a) 0
b) Garbage value
c) NULL
d) 1
11. The index of the first element in an array is:
a) 1
b) -1
c) 0
d) None

12. Which keyword is used to define a class in C++?


a) struct
b) object
c) define
d) class

13. Which function is automatically called when an object is created?


a) Destructor
b) Constructor
c) main()
d) getdata()

14. Which of the following loops executes at least once?


a) for loop
b) while loop
c) do-while loop
d) if loop

15. Which of the following is not a relational operator?


a) ==
b) !=
c) =
d) >=

16. What is the correct syntax to declare an array of 5 integers?


a) int arr(5);
b) int arr[5];
c) int[5] arr;
d) array int arr[5];
17. Which header file is used for file handling in C++?
a) <fstream>
b) <file>
c) <iostream>
d) <filestr>

18. Which of the following is an example of polymorphism?


a) Function overloading
b) Data hiding
c) Inheritance
d) Encapsulation

19. Which of the following symbols is used for the scope resolution operator?
a) .
b) ->
c) ::
d) :

20. Which of the following statements correctly declares a pointer?


a) int ptr;
b) int *ptr;
c) *int ptr;
d) ptr int*;
💡 Section B — Short Programming Questions (ANY 2)

Q1. Write a program to input two numbers and display their sum, difference, product, and
division.

Q2. Write a program that prints a multiplication table of any number entered by the user.

Q3. Write a program using a for loop to print numbers from 1 to 10.

OR

IF-ELSE – PROGRAM (ANY 2)

Q1. Write a program to find the largest of three numbers using if-else statements.

Q2. Write a C++ program to check whether a number entered by the user is even or odd.

Q3. Write a C++ program using a class Student with data members name, marks, and a
function display() to show student details.

You might also like