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

XII First Term Exam 2024

Uploaded by

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

XII First Term Exam 2024

Uploaded by

iqra ilyas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Army Public School (SCO) Misrial Road Rawalpindi

First Term Exam 2024

Name: ____________ Subject: Computer Science Class: XII Total marks:75

SECTION-A

Encircle the correct option. (13)

1. Which of the following is a reserved keyword in C++?


a) Main b) Print c) Const d) Variable
2. What is the correct header file to include for input and output operations in C++?
a) <stdio.h> b) <conio.h> c) <iostream> d) <stdlib.h>
3. In the SDLC, what is the main purpose of the feasibility phase?
a) To develop a prototype b) To determine whether the project is viable
c) To deploy the system d) To maintain the system
4. What type of operating system allows multiple users to work on the same system
simultaneously?
a) Single-user OS b) Multi-user OS c) Batch OS d) Distributed OS
5. Which one of the following states transitions is valid?

a) Ready to b) Blocked to c) Running to d) Terminated to Running


Blocked Running Ready

6. Which one of the following DOS commands is used to display content of the directory?

a) DIR b) CD c) MD d) VIEW

7. Identify the type of system conversion in which the old system is directly replaced by the
new system:

a) Pilot b) Parallel c) Direct d) Phased

8. Which one of the following statements transfers the control to the start of loop body?

Page 1 of 5
a) switch b) continue c) break d) exit()

9. if x=5, which one of the following accesses the 7th element stored in an array A?

a) A[x++] b) A[++x] c) A[7] d) A[x]

10. Which of the following operators is used to form compound condition?

a) Arithmetic b) Assignment c) Relational d) Logical

11. Which of the following is NOT a function of an operating system?


a) Memory Management b) Process Management
c) Virus Protection d) File Management
12. What is the correct syntax to declare a 2D array in C++?
a) int array[rows][columns]; b) int array(rows, columns);
c) array<int, rows, columns>; d) int array{rows, columns};
13. Which loop is guaranteed to execute at least once?
a) For loop b) While loop c) Do-while loop d) Nested loop

Page 2 of 5
SECTION-B
Q#2: Attempt all parts. (3*14= 42)
i. Differentiate between functional and non-functional requirements.
OR Differentiate between unary and binary operators with one example each.
ii. What is planning phase in SDLC and what are the structures involved?.
OR what is process management. Explain with one example.
iii. What will be displayed after executing the following statements?
int x = 4, y = 17; cout << --y << “\t” << y / x++ << “\t” << x % y<<”\n”<<y;
OR Write down the output of the following statements:
a. A = (x <=5) && (y >=15) where x = 5, y = 15
b. S = 20 - 16 % 4
c. m += 2; where m = 2
iv. Write down the purpose and syntax of break statement
OR Write down the purpose and syntax of exit() function.
v. Why is it important to write Comments in a program? Also differentiate its two types.
OR What is the difference between constant and variable? Give examples also.
vi. Write down the output of the following program segment:
char c = ‘A’;
do { cout << c << ”\t”; c = c + 3; }
while (c <= ‘K’ ); OR
Write down the output of the following program segment: int values [ ] = {4, 17, 20, 9, 23};
cout << values [0] << "\n"; cout << values [3] <<"\n"; cout << values [1]<<"\n";
vii. Rewrite the following statement using if-else statement:
cout << ( ( (num % 2) = = 0) ? "Even \ n" : "Odd \ n");
OR
Convert the following while loop to a for loop such that the output remains same.
int i = 20;
while (i > 0)
{
cout << i << “\t”; i = i - 2;
}
viii. What is the difference between array size and index? Illustrate with example

Page 3 of 5
OR
Rewrite the program segment after removing errors:
int a{10}, i; cout >> ” enter ten numbers ;
for (i = 0; i < 10; i--)
cin << a{i};
ix. Write down the purpose of sizeof() function with example.
OR
Consider the array definition: float table[5][5];
a. How many elements does an array have?
b. Write statement that assigns 36.5 to the first element of array.
x. What is OS and Describe its core functionalities.
OR
Write the stakeholders of SDLC.
xi. Write are the steps involved in deployment phase of SDLC.
OR
What are the key roles and duties of system analyst in SDLC?
xii. Write nested loop to print the following on the screen:
**********
**********
**********
OR
What is embedded OS?
xiii. Declare an array named arr, that has 3 rows and 5 columns and assign it values from 1 to
15 in the declaration statement.
OR Differentiate between strcmp() and strcpy() with one example each.
xiv. What is the advantage of using cin.get() over cin statement for reading a string? Explain
with an example.
OR
What is the purpose of iostream.h, conio.h, math.h and string.h header files also write few
of their built-in functions.

Page 4 of 5
SECTION-C
Attempt all parts. (5*4= 20)
Q#3: Write a C++ program that displays the following menu:
Geometry Calculator
1. Display Area of a Circle
2. Display Area of a Rectangle Enter your choice (1-3):
 If user enters 1, the program should ask for the radius of the circle and then display its
area. Use formula: area = πr2.
 If user enters 2, the program should ask for the length and width of the rectangle and
then displays its area, use formula: area = length x width.
 Display an error message if the user enters a number outside the range of 1 - 3.
OR
Write a C++ code that prints sum of the following series: 12 + 32 + 52 + 72 + . . . .+ 992
Q#4: What is a process and write its various states along with block diagram.
OR
Write a program that reads a string and copies it into another string and print on the screen.
Q#5: Write a program to input data from keyboard in a two-dimensional array x, that has x
rows and c columns and print the sum of each row in the following format:
Sum of row 1 =
Sum of row 2 =
.
.
Sum of row r =
OR
Write a program that takes 2 strings from user and print both strings with their lengths.
Q#6: Write a program that reads three strings and prints the smallest.
OR
Explain multi-threading and multi programming OS with one example each.

Page 5 of 5

You might also like