CS201-MidTerm-By Rana Abubakar Khan
CS201-MidTerm-By Rana Abubakar Khan
CS201-MidTerm-By Rana Abubakar Khan
MCQs were very easy also subjective was just like chewing bubble.
MCQs were 18
3 Marks Q = 2
5 Marks Q = 3
1
Q.1 Write the code of the following arrays; Marks(3)
int number;
if(number/2==0)
else()
getch();
2
}
Q.3 Write a program in C++ to calculate the Average Price of the book. Marks(5)
int number=8;
if(nt<number/2)
coutIt"\t";
s=nt+It
3
nt=It
s=It
4
3. Output of program having arrays
4. To write a program arrays of 10 elements. Sorting. Find minimum and maximum numbr
For mcqs just study past papers and read handouts once
A hierchy of classes which are used to deal with console and disk file.. iOS..
SUBJECTIVE.
5
Write 2d array with five rows and six column and also write pointer to above array.?
Then 2 program likhi thy inline output likhi thy ak array main say tha aur doses open file...
r long q
main(){
int x = 10
*ptr = 5 ;
6
Hint:
#include <iostream.h>
union mytypes_t {
char c;
int i;
float f;
} mytypes;
int main(){
mytypes.c = 'H';
mytypes.i = 15;
cout sizeof(mytypes)endl;
mytypes.i = 15;
mytypes.c = 'H';
cout sizeof(mytypes)endl;
system("PAUSE");
return 0;
7
CS201 MIDTERM PAPER SHARED BY STUDENT
Hint:
#include <iostream.h>
union mytypes_t {
char c;
int i;
float f;
} mytypes;
int main(){
mytypes.c = 'H';
mytypes.i = 15;
cout sizeof(mytypes)endl;
mytypes.i = 15;
mytypes.c = 'H';
cout sizeof(mytypes)endl;
8
system("PAUSE");
return 0;
r 1 or Q: JO 3 marks ka tha wo ye
Identify the errors in the following code segment and give the reason of errors.
main(){
int x = 10
*ptr = 5 ;
baqi 1 programme likhta tha convert weight wala sai sy baqi yad na
***CS201***
Aik program likhen jismai aik item ka 15% tax display krwana hai. Program mai pehle user sy input lyn phr uska
15% tax display krwana hai
***CS201***
Aik program bnayen jismai user sy input lyn radius ki or switch statement sy 2 case likhen
****CS201****
9
Aik 2D array bnayen jismai 4 rows hn or 2 cols or phr usko display krwayen(mene rand() use kia) phr usmai 1st
row ky elements display krwayen msln agr aik array hai
23 43. 5. 84.
54. 42. 1. 75
To display ho
23 43 5 84
By amna mughal
5 marks
Write a program using switch statement that should prompt the user to enter radius of circle.
10
After getting input from user, it should display the following menu to user.
When user enters correct choice then corresponding task should be executed.
If user presses key other than above option then message “Option is not available” should be
displayed on output screen.
Formula for:
Another Paper:
Q3:name any three system software and explain how system software controls hardware.?
11
CS201 MIDTERM PAPER SHARED BY STUDENT
subjective paper:
Q19: marks 3
int num[3][2]={12,51,34,54,14,55};
cout(*(*num+j)+1)endl;
Q20: marks 3
a=3;
b=a++;
12
cout"a="a;
cout"b="b;
Q21: marks 5
write a code to read a string not greater than 20 character from keyboard, store it in on array and display it on
screen.
Q22: marks 5
calculate the area of circle. you have to declare two variables for this, one is area and other is radius. take the
value of radius from user.
Q23: marks 5
write a program that prompts the user to enter a string & reverse the string using pointer & display the string in
reverse order on the output screen. program must include the complete line include spaces.
13
CS201 MIDTERM PAPER SHARED BY STUDENT
ASSLAM O ALIKUM
1. float array[8] declare krni the and then pointer pas krna tha.
3. net salary caluculate krni the c++ program likh kr dailywages= 1000 aur no of days
THANKS
14
CS201 MIDTERM PAPER SHARED BY STUDENT
Subjective:
Q-Write a code segment that displays the diagonal element of a matrix of NxN.
Q-Mention any two affects in a programme who can occur as a result of an overflow condition.
1. You can use a ____GOTO_____ statement to transfer control elsewhere out of the nested structure.
2 Overflow condition occurs when we try to assign a value to a variable which is __________.
3. Reusing the __________ in program helps to save the memory.
4 When an array is passed to a function, by default it will be passed by_____________.
5. There are mainly -------------------- types of software.
6. In 2D array, the technique used to access the array elements is called ___________.
7. Characters are represented inside the computers in terms of code number which is called ________ encoding
scheme.
8. __________ is used to check for the end of file when a file is being read.
15
9. When the logical operator AND (&&) combines two expressions exp1 and exp2 then the result will be true only
____________
10. The left-shift operator can be used to pck two character values into a ____________ integer variable.
.......................................................................
Subjective question
#include
main()
{
objective
1. Which of the following has the general equation of the form , where a,b,c,d are real numbers.
8. If has a relative extremum at a point and both the first partial derivatives of exist at this point, then . . . . . . . . . . . .
16
9. If has a relative extremum at a point and both the first partial derivatives of exist at this point, then
10. Double integral of a function represents . . . . . . . . . of the region between the surface defined by the function
and the plane which contains its domain.
17