PART I. Answer “True” or “False” T or F 1 . The cout object can be used to displ
ID: 3734283 • Letter: P
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 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 <iostream>
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 “<<endl;
}
IV. Show the output of following programs.
1)
#include <iostream.h>
#include <iomanip.h>
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 <iostream.h>
int main ( )
{
int y =0;
int x =1, total =0;
while ( x <= 6)
{
y +=x ;
cout <<"Y ="<< y <<endl;
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
Explanation / Answer
As per Chegg policy, I am answering only first 4 subpart. In order to get the remaining questions please upload them again.
Part 1.)
1.) True. The cout object can be used to display all of C++'s data types.
2.) True. We can use but we shouldn't.
3.) False. C++ is case sensitive.
4.) True. Compiler generates object file and linker generates executable file.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.