0% found this document useful (0 votes)
25 views2 pages

CS - 101 - Programming With C++ 1st Sem 2018

This document is an examination paper for the subject 'Programming with C and C++' at the Indian Institute of Information Technology, Kalyani, for B.Tech students. It consists of various programming questions that require students to analyze code snippets, explain concepts like classes, operator overloading, and recursion, and solve problems related to sorting and matrix multiplication. The paper has a total of 50 marks and includes specific instructions for answering the questions.

Uploaded by

Sayan Mandal
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)
25 views2 pages

CS - 101 - Programming With C++ 1st Sem 2018

This document is an examination paper for the subject 'Programming with C and C++' at the Indian Institute of Information Technology, Kalyani, for B.Tech students. It consists of various programming questions that require students to analyze code snippets, explain concepts like classes, operator overloading, and recursion, and solve problems related to sorting and matrix multiplication. The paper has a total of 50 marks and includes specific instructions for answering the questions.

Uploaded by

Sayan Mandal
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/ 2

B.

Tech/CSE/ist Sem-E/2018/CS 101

Indian Institute of Information Technology, Kalyani


End-Semester Examination 2018
Subject: Programming with C and C++ Time: 03 hrs.
Paper Code: CS 101 Full Marks: 50

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.

QI. Answer any 5 questions. print{("Yd ".i);


[2x5=10] }
(i) What is the output of this program ?
return 0;
}
#include<stdio.h>
int main() {
int a=10; (iv) What will be the value of a and y
at+=a*a%2; after executing the program for x = 2.1?
a%=2; #include <stdio.h>
if((a=0)) int main ()
print{('Correct"); i
else
double x, y;
printf{('Wrong");
return 0; long int a;
} scanf("%lf", &x);
y=x- (int)x;
(ii)What will be the output of the following a = (int)x;
program, when the input 7 ? is if (vy >= 0.5) ++a;
printf{('\na = %f, y = Yf", a, y);
#include<stdio.h>
int main() return (0);
Q
¥y }

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 ;

arguments are required in the definition of an


overloaded binary operator? Write a program to
overload (--) operator. 39
[2+1+7=10] 3354
4444
Q4. What is a resursion function? Where is it
useful? Write a resursive function to output the
$333
22
factorial of a given number N.What is the |
output of the program bellow?

#include<stdio.h>
What is the out put of the following program?

int find(int number) #include <stdio.h>


‘ int main()
if (number == 0) a
f

return 0; char
c;
/
else
return (number % 2 + 10*find(number 2)); for(ce='A'; c <='Z'; +40)
i
J print{("%c ", c);

int main() return 0;


J Q
d
JS

int number = 39;


[8+2= 10]
print{('%ad", find(number));
return 0;
Y

[1 +1+5+3=10]

Q5. Explain the steps to multiply two matrices


for given dimensions. Write a program
following the steps.

[10]

FRR RR OK A EN]
D8 KK

You might also like