0% found this document useful (0 votes)
6 views3 pages

Test Series - Version - 1

This document outlines a test series for Computer Science at Army Public School & College Jinnah Campus, covering chapters on functions and pointers. It includes multiple-choice questions, subjective questions, and programming tasks related to the syllabus. The test is designed for Class XII students and consists of various question formats to assess their understanding of the topics.

Uploaded by

hassamsalman098
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)
6 views3 pages

Test Series - Version - 1

This document outlines a test series for Computer Science at Army Public School & College Jinnah Campus, covering chapters on functions and pointers. It includes multiple-choice questions, subjective questions, and programming tasks related to the syllabus. The test is designed for Class XII students and consists of various question formats to assess their understanding of the topics.

Uploaded by

hassamsalman098
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
You are on page 1/ 3

Army Public School & College Jinnah Campus, Gujranwala Cantt

Test Series # 2(version_1)


February– 2025
Syllabus: ch#6(functions)
Syllabus: ch#7(Pointers)
Name: __________________
Class: XII (____)
Subject: Computer Science Time Allowed: 1 hr 30 Mins Marks: _____ / 50

Q1: Fill in the relevant bubble for each part. (1 x 10 = 10)


S# Question A B C D
A B C D
Only inside
What is the scope Inside all
the function Only inside
1. of a variable Globally functions in
but persists the function
declared as "static" available the file
between for one call
inside a function?
calls
Which of the
following Subtracting Comparing
2. Incrementin Adding two two
operations is one pointer
g a pointer pointers pointers
invalid on from another
pointers?
Which of the Public and Compiler
3. Static and Built-in and and linker
following is a type private
dynamic user-defined
of function?
What does the Declares a Accesses a Modifies the Allocates
4. reference operator variable memory value of a dynamic
& do? address variable memory
The
The main
Elaborate the combination The header
5. body of the The return type
function signature of a function's of the file
function of the function
parts. name and
parameters
Which operator is
used to access the *(Dereferen
6. & (Address .
value at the memory ce operator) ->
operator)
address a pointer
point to?
What is the correct
. Global Local
7. term for variables Static variables Parameters
variables variables
declared inside a
function?
How is a pointer
8. declared in C++? int* ptr; int ptr; int &ptr; int^ ptr;

Which of the
following keywords
9. is used to define a . static const volatile auto
static variable in
C++?
What will be the
output of this code? Value at
Compilation address of
10. int a = 10; Address of a Value of a
error ptr
int* ptr = &a;
std::cout << *ptr;

Section B (Subjective)
Q2. Attempt all the given questions. Each question carries equal marks (8 x 3 = 24)

Finding the Output: Finding the Output:


int a = 5, b = 10;
int a = 20;
int* ptr = &a;
(i) 3 OR int* ptr = &a;
3
ptr = &b;
std::cout << *ptr * 2;
std::cout << *ptr;

Write a C++ program to declare an integer Write down the program that take
pointer in the main function, assign it the
values as input in main function and pass
(ii) address of an integer variable, and 3 OR 3
to function and find the product of that
display the value of the integer using both
number then return to main function?
the pointer and the variable.
Explain how a pointer can be In what scenarios can multiple
declared and initialized functions with the same name and
simultaneously in a program. return type coexist in a program, and
(iii) 3 OR 3
Additionally, discuss potential pitfalls what rules govern their proper
of uninitialized pointers and their declaration and usage?
impact on program behavior
What are the critical distinctions between
formal and actual parameters, and how Write down the code to print the
(iv) does their relationship affect the 3 OR factorial of a number but using 3
execution of functions and the passing pointer to achieve this task?
arguments as reference?
How does the return statement
How can you determine the memory contribute to the overall functionality
(v) address of a variable? Write a code 3 OR of a function, and in what ways does it 3
snippet to demonstrate affect the flow of execution within a
program?
Fine the error in the given code:
Sum int ()[ Differentiate between a function
definition and a function call with
(vi) Int 10x=100; 3 OR examples. 3
Cout<<10x<<endl;

]
How can you write a function to Write down the program that print
calculate the square of a number, reverse of the number on screen using
(vii) 3 OR 3
ensuring it return that square in main functions.(example let n=1234 then
function and then print on Screen? reverse would be n=4321)
What is the output of the following code?

int s=90; What is the significance of inline


int *d=&s; functions, and how do they balance
(viii) 3 OR 3
performance optimization with code
cout<<*(*d)<<endl; readability and maintainability?

Section C
Attempt all the given parts. (2 x 8 = 16)
i)Write down the function that print the
following pattern on screen
******
*****
****
***
**
* How would you define a pointer in
4 programming, discuss any four key
+ advantages of using pointers, and
Q.3 ii)Write down the function that print the OR 8
demonstrate their declaration and
following pattern on screen 4 initialization with the help of a relevant
*
code example?
**
***
****
*****
******
*******

i)write a c++ program to get an integer


number from keyboard in main
How would you comprehensively define a
program and pass it as an argument to a 4
function in programming, and what are
function where it calculates and display
Q.4 the various types of functions? Discuss OR +
8 a table.
each type in detail with appropriate
ii)write a c++ program that print the sum 4
examples to illustrate their practical
of even number from 1 to 50 and finally
applications.
print the average these number on
Screen

You might also like