CS - 101 - Programming With C++ 1st Sem 2018
CS - 101 - Programming With C++ 1st Sem 2018
Instructions:
[1]. Answer question | and any 4 questions. [2] All parts of a question should be answered
consecutively. [3]. Answer the questions to the points. [4]. Answer script should be neat and clean.
[5]. No. of pages in the question paper: 02.
int num,out;
Jor(scanf("%d", &num),out=0;num!=0; (v) What is the output of the program?
out=out*10+(num%10),num=num/10);
print{("%a" out); #include<stdio.h>
return 0; int A(int m, int n)
J
i {
if (!m)
(iii) What will be the output of the following return (n + 1);
program? if (in)
return A(m - 1, 1);
#include <stdio.h> return A(m- 1, A(m, n- 1));
}
int main()
Jf
i
int main() {
int i, j; printf("A(1,2) = %d", A(1,2));
for (i = 0; i <= 2; i++) return 0;
{ }
Sor
J
j = 0; j <= 2.) (vi) Define a constructor with syntax.
’
(vii) Explain new and delete with syntax.
printf("%d "j);
break;
;
(viii) Explain and give syntax of how to open file
in read mode.
Q2. What is a class? Explain the syntax of a Q6. Write steps to implement “Quick sort”
class declaration with example. How it differs algorithm and follow the steps with appropriate
from structure? Explain structure declaration
program.
with syntax and example.
[10]
[2+3+2+3=10]
Q7. Write a program to out put the following
Q3. What is operator overloading? How many pattern ;
#include<stdio.h>
What is the out put of the following program?
return 0; char
c;
/
else
return (number % 2 + 10*find(number 2)); for(ce='A'; c <='Z'; +40)
i
J print{("%c ", c);
[1 +1+5+3=10]
[10]
FRR RR OK A EN]
D8 KK