Answer / % \ !
.2 points
Question 2 Which one of the following is defined as a sequence of characters?
Answer String Constant Integer Variable
.2 points
Question 3 Which one of the following variables is assigned with valid literals?
Answer int salary = 0; salary = 5000.50; unsigned short salary1 = 0; salary1 = 1E6; double salary2 = 0; salary2 = 2.96E-2; unsigned long salary3 = 0; salary3 = 1E-6;
.2 points
Question 4 What is the value inside the "value" variable at the end of the given code snippet?
#include <iostream> using namespace std; int main()
{
int value = 3; value = value - 2 * value; value++; return 0;
}
Answer -2 0 2 4
.2 points
Question 5 What is the output of the following code snippet?
#include <iostream> using namespace std; int main()
{
int value = 3; value++; cout << value << endl; return 0;
}
Answer 2 3 4 No output due to syntax error
.2 points
Question 6 Which of the following options is valid with reference to the code snippet?
#include <iostream> using namespace std; int main()
{
double d = 45.326; double r = d % 9.0; cout << r; return 0;
}
Answer The value inside the variable r will be 0.326 The value inside the variable r will be 5.036 Variable r has to be defined as an integer as the % operator always returns an integer The assignment statement for variable r is wrong, as the % operator expects integer values as operands
.2 points
Question 7 Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in the following code snippet, what is the output? int main()
{
cout << "Enter the price: "; double price; cin >> price; cout << "Enter the discount rate: ";