Docsity

Computing Fundamentals Terminal Exam Solutions, Exams of Computer Fundamentals

Toggle sidebar
bg1
Computing Fundamentals โ€“ Terminal Exam
Solutions
Q1-
0 1 2 3 4 5 6 7 8 9
Q2-
void swap(int &a, int &b){
int temp;
temp=a;
a=b;
b=temp;
}
Q3-
int a=20;
int &b=a,&c=a;
cout<<"Address of A = "<<&a<<endl;
cout<<"Address of first ref-A"<<&b<<endl;
cout<<"Address of second ref-A"<<&c<<endl;
Q4-
Memory Address of A[0] --Value of A[0] i.e. 0x*****--123
Memory Address of A[1] โ€“ Value of A[1] i.e. 0x*****--45
Q5-
void copyArray(int A[],int B[],int size){
for(int a=0;a<size;a++)
B[a]=A[a];
}
Q6-
Docsity.com
pf2

Partial preview of the text

Download Computing Fundamentals Terminal Exam Solutions and more Exams Computer Fundamentals in PDF only on Docsity!

Computing Fundamentals โ€“ Terminal Exam

Solutions Q1- 0 1 2 3 4 5 6 7 8 9 Q2- void swap(int &a, int &b){ int temp; temp=a; a=b; b=temp; } Q3- int a=20; int &b=a,&c=a; cout<<"Address of A = "<<&a<<endl; cout<<"Address of first ref-A"<<&b<<endl; cout<<"Address of second ref-A"<<&c<<endl; Q4- Memory Address of A[0] --Value of A[0] i.e. 0x*****-- Memory Address of A[1] โ€“ Value of A[1] i.e. 0x*****-- Q5- void copyArray(int A[],int B[],int size){ for(int a=0;a<size;a++) B[a]=A[a]; } Q6-

Docsity.com

int A,B, num; cout<<"Enter A : ";cin>>A; cout<<"Enter B : ";cin>>B; for(int a=0;a<10;a++){ num=rand()%(B-A)+A; cout<<num<<" "; } Q- int fac(int N){ if(N<=1) return 1; return N*fac(N-1); }

Docsity.com