CS (Boys) - Programming Fundamentals (CC-112)
CS (Boys) - Programming Fundamentals (CC-112)
Question No. 01: Find the output of the following Codes. (4*2=08)
a #include<iostream> b #include<iostream>
using namespace std; using namespace std;
int main() int i = 20;
{ int main()
int number = 10; {
if(number>10) int i = 10;
cout<<"Number is greater than 10"<<endl; for(int i=15;i<16;i++)
cout<<"Number is Integer"<<endl; {
cout<<"For Loop Executed"<<endl;
if(number=10) }
cout<<"Value of the number is 10"<<endl; cout<<"The value of vriable is "<<i<<endl;
cout<<"The value of vriable is "<<::i<<endl;
return 0;
} return 0;
}
c #include<iostream> d #include<iostream>
using namespace std; using namespace std;
int main() int main()
{ {
int Arr[1][2][3]={{{3,4,7},{2,5,6}}}; for(int i=0;i<5;i++)
int temp=0; cout<<i<<endl;
temp = Arr[0][0][1]; cout<<"Loop Ended"<<endl;
Arr[0][0][1] = Arr[0][1][1]; return 0;
Arr[0][1][1] = temp; }
cout<<Arr[0][0][1]<<endl;
cout<<Arr[0][1][1];
return 0;
}
a 1. #include<iostream> b 1. #include<iostream>
2. using namespace std; 2. using namespace std;
3. int main() 3. int main()
4. { 4. {
5. int Arr[5] = {1,1.5,2,2.5,3,3.5}; 5. for(int i =0;i<5;j++);
6. cout<<"Value of Array: " 6. {
7. cout<<Arr[5]; 7. cout<<"Loop Executed<<endl;
8. }
8. return 0; 9. cout<<"Loop Terminated"<<endl;
9. } 10. return 0;
11. }
c 1. #include<iostream> d 1. #include<iostream>
2. using namespace std; 2. using namespace std;
3. int main() 3. int main()
4. { 4. {
5. char Arr[3]; 5. bool gcp = false;
6. Arr[0] = "C"; 6. if(gcp=true);
7. Arr[1] = "+" 7. {
8. Arr[2] = '+'; 8. cout<<"No Spelling Mistake"<<endl;
9. cout<<"Good to go"<<endl;
9. for(int i=0;i<=3;i++) 10. }
10. { 11. else()
11. cout<<Arr[i]<<endl; 12. {
12. } 13. cout<<"Speling Mistake"<<endl;
13. cout<<"Array of Character 14. cout<<"Corret the spellings"<<endl;
Printed"<<endl; 15. }
14. return 0; 16. return 0;
15. } 17. }