Professional Documents
Culture Documents
H.W #1S
H.W #1S
Fall 2022-23
Section 3 Friday, 9 Sept 2022
Homework: Week-1
Solution
Theory Questions:
Q 1) What task does a compiler perform?
Ans) The compiler translates the source code into machine code and creates an object file
#include <iostream>
int main()
cout<< “Hello”;
cout<< “World”;
return 0;
}
Ans) Output:
Hello
World
HelloWorld
Q 6) What services does the following header provides for the program
#include <iostream>
Ans) It provides input and output services.
Programming Questions:
Q 1) Print your name using “*”.
Sample output
Ans)
#include <iostream>
int main()
{
Ans)
#include <iostream>
int main()
cout<<”Hola”<<endl;
return 0;
}
Q 3) Print the following sample output:
Ans)
#include <iostream>
using namespace std;
int main()
{
cout << "#" << endl;
cout << "##" << endl;
cout << "###" << endl;
cout << "####" << endl;
cout << "#####" << endl;
cout << "######" << endl;
}