Question: PART I. Answer True or False T or F 1 . The cout object can be used to display all of C++s data types. T
PART I. Answer True or False
T or F 1. The cout object can be used to display all of C++s data types.
T or F 2. You can use the keywords in C++ to declare a variable.
T or F 3. C++ is not case sensitive.
T or F 4. The compiler generates object file and linker generates executable file.
T or F 5. The increment operator x++ increments x before its value is used.
T or F 6. A nested if-else statement is slower than series if single if else statement.
II. Assume all variables are of type int and each expression is independent of other one. Find the value of the following expressions :
a=3, b=5, c=6 , d=-6 Value of y
a) y= a++ * ++d + ++c; ________
b) y= --a/++b + d--/2; ________
III. Find the syntax errors in the following programs and fix them.
1.
\\ A simple program
#include
int main ( )
{
int a=10, b=24;
char ch = a;
cout << Sum = << a +b << endl;
cout << The character is : << ch;
<< endl;
return 0;
}
2.
// Second program
int main ( )
{
for ( y = 0.1; y != 1.0, y += 0.1 )
cout << y << endl;
cout << Last y = << y < } IV. Show the output of following programs. 1) #include #include int main () { int c = 0; for (int i=0,j= 1; (i <=4 && j <=5); ) { c += i+j; cout << setw (5) << ++i << setw (5) << c << endl; } return 0; } ____________________________________________________________ #include int main ( ) { int y =0; int x =1, total =0; while ( x <= 6) { y +=x ; cout <<"Y ="<< y < total += y; ++x; } cout << "Total is = " << total << endl; return 0; } PART V Write a C++ program to prompt the user to enter the following selection. If the user enters 1 (by pressing "1") then your program has to print all even numbers from 0 to 100 (inclusive). If the user enters 2 (by pressing "2") then your program should prompt the user to enter the first character of his/her first, middle, and last name and also four digit student I.D. number and print them as follows. If the user enters any other choice (number), you should terminate the program. Sample output: ABC 1212
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
