:happy: السسسسسسلام عليكـم
انا محتاجـه انـي احل هـ sheet باسرع وقـت ممكن
فاليت تسساعودني بجد محتاجتكم
Fill in the blanks in each of the following:
1- ………………….are used to document a program and improve its readability.
2- The level of computer language most convenient to the programmer for writing programs quickly and easily is……………………..
3- The object used to print information on the screen is …………………
4-………………….The object inputs values from the keyboard.
5- A location in the computer's memory that may contain different values at various times throughout the execution of a program is called a ………………………
________________________________________
Second question :
Write a single C++ statement or line that accomplishes each of the following:
1- Print the message "Enter two numbers".
2- Assign the product of variables b and c to variable a :
3- Input three integer values from the keyboard and into integer variables a, b and c.
________________________________________
Third question :
1- Which of the following C++ statements contain variables whose values are replaced?
a) cin >> b >> c >> d >> e >> f;
b) p = i + j + k + 7;
c) cout << "variables whose values are destroyed";
d) cout << "a = 5";
________________________________________
2- What prints when each of the following C++ statements is performed? If nothing prints, then answer “nothing.”
Assume x = 2 and y = 3.
a) cout << x;
b) cout << x + x;
c) cout << "x=";
d) cout << "x = " << x;
e) cout << x + y << " = " << y + x;
f) z = x + y;
g) // cout << "x + y = " << x + y;
________________________________________
3- Given the algebraic equation y = ax3 + 7, which of the following, if any, are correct C++ statements for this equation?
a) y = a * x * x * x + 7;
b) y = a * x * x * ( x + 7 );
c) y = ( a * x ) * x * ( x + 7 );
d) y = (a * x) * x * x + 7;
e) y = a * ( x * x * x ) + 7;
f) y = a * x * ( x * x + 7 );
________________________________________
4- State the order of evaluation of the operators in each of the following C++ statements and show the value of x after each statement is performed.
a) x = 7 + 3 * 6 / 2 - 1;
b) x = 2 % 2 + 2 * 2 - 2 / 2;
c) x = ( 3 * 9 * ( 3 + ( 9 * 3 / ( 3 ) ) ) );
Fourth question :
Determine which of the following variables name is valid or invalid :
_under_bar_ z2 h22
2h 67h2 his_account_total
t5 87 m928134
her_sales 3g j7
a b c
________________________________________
Fifth question :
Find the error in the following program:
1)
// Addition program that display the sum of two numbers.
#include <iostream>
int main()
{
int number1;
int number2;
std::cout << "Enter first integer: \n";
std::cin << number1;
std::cout << "Enter second integer: \n";
std::cin >> number2;
sum = number1 + number2;
std::cout << "Sum is " << sum << std::endl;
}
________________________________________
2)
//print message "hello world " in the screen .
int main()
{
std::cout << "hello world \n"
return 0;
}
________________________________________
Sixth question :
What does the following code print?
cout << "*\n**\n***\n****\n*****\n";
Seventh question:
Write a C++ programs that:
1- prints the numbers 1 to 4 on the same line with each pair of adjacent numbers separated by one space.
Write the program using the following methods:
a) Using one output statement with one stream insertion operator.
b) Using one output statement with four stream insertion operators.
c) Using four output statements.
2- program that asks the user to enter two numbers, obtains the two numbers from the user and prints the sum, product, difference, and quotient of the two numbers.
3- program that reads in the radius of a circle and prints the circle’s diameter, circumference and area. Use the constant value 3.14159 for . Do these calculations in output statements.