CS201p Finalterm Paper 2023 No 1
MCQS 20Totaly from handouts
Question 1
Important points about
Variable in C++.
Answer:page 16
Question 2
Write a program that print the sum of 1 to 1000 odd numbers using while loop
Answer:page 48
Question 3 error correct karnay thay
Answer:page 382 and 383
Question 4 program ke output find Karni the two dimensional array ka tha program
CS201p Current Paper 2023 Finalterm No 2
MCQs from handout
Subjective 4 questions
Q1.write output from this code
#include<iostream>
Using namespace std;
Int num1= 34, int num2 = 45 int= num3 = 46
If(num1 >num2&& num 1>num3)
Cout<<number 1 is greater ;
Else if (num 2 >num1 && num2>num3
Cout<< number 2 is greater;
Else if (num3>num1 & num3 >num2)
Cout<<number 3 is greater;
Else
Cout<<All number are equal;
Q2.write output in this code
Intnum1=4,num2=5,fact 1= 1 fact2= 1
While (num1>1)
{
Fact1= fact 1*num1;
Num1 = num 1-1;
}
Cout<< the function of number 1 is <<fact 1<<endl;
While
Fact2= fact2*num2;
Num1 = num 2-1;
}
Cout<< the function of number 2is <<fact 2<<endl;
If(fact >fact2)
Cout<<the factorial of number 1 is greater than 2
Cout<<the factorial of number 2 is greater than 1
Q3.write output
Template <classT>
Class first {
Public:
First ()
Cout<<created/n:
}
First ()
Cout<<destroyed/n:
}
Template <class u>
Class second {
Public:
Second{Cout<<created/n:
}
Second ()
Cout<<destroyed/n:
}
Q4. Write max 2 int program.
Allah sbko kamiyab kry duaon Mai yad rahky ga
I wish you very best of luck all
CS201p Finalterm Paper 2023
Paper asan tha kafi(as compare to CS201)
20 mcqs (was very easy and from lab quizzes)
5 descriptive questions (5 marks each)
Descriptive b kafi asan thy...2 ki output btani thi(both from classes) aur 1 theory wala tha( file handling se related) aur 1 code likhna tha (while loop wala)
CS201p Paper 2023
1.overload function square for integer and float data type. The overload function will take a single arguments square.
2.write program find sum odd number 1 to 1000 by using while loop.
3.write program print matrix shape element[2][2] by using class Matric.
4.write output (sum l books different Marks and find average and average compared by using if-esle statement)
4*(Marks 5)=20
Total marks 40
cs201p long questions
- #include <iostream>
using namespace std;
template<class T,int max>
int arrayMax(T arr[], int n)
{
int m = max;
for(int i=0 ; i<n ; i++)
if(arr[i]>m)
m= arr[i];
return m;
}
int main()
{
int array1[]={10,20,15,12};
int n1 = sizeof(array1)/sizeof(array1[0]);
char array2[]={1,2,3};
int n2 = sizeof(array2)/sizeof (array2[0]);
cout << arrayMax < int,10000>(array1,n1)<< endl;
cout << arrayMax < char,256>(array2,n2);
return 0;
}
Output btani thi is ki
- 1 if or else wala aya tha code likha howa tha us ki output likhni thi easy tha
- or 1 if else wala aya us me nested if bhi use howa pra tha wo correct kerna tha code me mistakes thi kafii
- 1 question tha user kio number enter kry us no. ka cube lena tha
long question me aya tha ...code likhna tha is ka