Test Series - Version - 1
Test Series - Version - 1
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)
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?
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?
**
***
****
*****
******
*******