27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
S1511 Module Site Assessment 4 Replacing AssNo 1
QUIZ
Started on Monday, 1 April 2024,
3:27 PM
State Finished
Completed on Saturday, 27 April
2024, 9:03 PM
Time taken 26 days 5 hours
Marks 49.00/56.00
Grade 87.50 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Which of the following is a valid variable
name?
a. 3com
b. three_com
c. 3_com
d. ampersand&
Your answer is correct.
The correct answer is:
three_com
Question 2
Correct
Mark 1.00 out of 1.00
Which of the following statements is
NOT legal?
a. char ch = 'b';
b. char ch = '0';
c. char ch = 65;
d. char ch = "cc";
Your answer is correct.
The correct answer is:
char ch = "cc";
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 1/33
,27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 3
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
float x;
x = 15/4;
a. 3.75
b. 4.0
c. 3.0
d. 60
Your answer is correct.
The correct answer is:
3.0
Question 4
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
int x;
x = 15/4;
a. 15
b. 3
c. 4
d. 3.75
Your answer is correct.
The correct answer is:
3
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 2/33
,27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 5
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
int x;
x = 15 % 4;
a. 15
b. 4
c. 3
d. 3.75
Your answer is correct.
The correct answer is:
3
Question 6
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statement?
float x;
x = 3..0 + 3 + ;
a. 5.75
b. 5,75
c. 1.75
d. 3.75
Your answer is correct.
The correct answer is:
3.75
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 3/33
, 27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 7
Incorrect
Mark 0.00 out of 1.00
Which C++ statements correctly declare
a variable called age, and prompt a user
for his/her age.
a. int age = 0;
cout >> "Please enter your age: ;
cin << age;
b. int age = 0;
cout << "Please enter your age: ";
cin >> ages;
c. int age = 0;
cout << "Please enter your age: ";
cin >> age;
d. int ages = 0;
cout << "Please enter your
age: ";
cin >> age;
Your answer is incorrect.
The correct answer is:
int age = 0;
cout << "Please enter your age: ";
cin >> age;
Question 8
Correct
Mark 1.00 out of 1.00
Which C++ statement is the equivalent of
the following statement using a single
arithmetic assignment operator?
sum = sum + 47;
a. sum += 47;
b. sum == 47;
c. sum +47;
d. sum += sum;
Your answer is correct.
The correct answer is:
sum += 47;
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 4/33
S1511 Module Site Assessment 4 Replacing AssNo 1
QUIZ
Started on Monday, 1 April 2024,
3:27 PM
State Finished
Completed on Saturday, 27 April
2024, 9:03 PM
Time taken 26 days 5 hours
Marks 49.00/56.00
Grade 87.50 out of 100.00
Question 1
Correct
Mark 1.00 out of 1.00
Which of the following is a valid variable
name?
a. 3com
b. three_com
c. 3_com
d. ampersand&
Your answer is correct.
The correct answer is:
three_com
Question 2
Correct
Mark 1.00 out of 1.00
Which of the following statements is
NOT legal?
a. char ch = 'b';
b. char ch = '0';
c. char ch = 65;
d. char ch = "cc";
Your answer is correct.
The correct answer is:
char ch = "cc";
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 1/33
,27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 3
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
float x;
x = 15/4;
a. 3.75
b. 4.0
c. 3.0
d. 60
Your answer is correct.
The correct answer is:
3.0
Question 4
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
int x;
x = 15/4;
a. 15
b. 3
c. 4
d. 3.75
Your answer is correct.
The correct answer is:
3
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 2/33
,27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 5
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statements?
int x;
x = 15 % 4;
a. 15
b. 4
c. 3
d. 3.75
Your answer is correct.
The correct answer is:
3
Question 6
Correct
Mark 1.00 out of 1.00
What is the value of x after the following
statement?
float x;
x = 3..0 + 3 + ;
a. 5.75
b. 5,75
c. 1.75
d. 3.75
Your answer is correct.
The correct answer is:
3.75
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 3/33
, 27/04/2024, 21:05 Assessment 4 Replacing AssNo 1: Attempt review
Question 7
Incorrect
Mark 0.00 out of 1.00
Which C++ statements correctly declare
a variable called age, and prompt a user
for his/her age.
a. int age = 0;
cout >> "Please enter your age: ;
cin << age;
b. int age = 0;
cout << "Please enter your age: ";
cin >> ages;
c. int age = 0;
cout << "Please enter your age: ";
cin >> age;
d. int ages = 0;
cout << "Please enter your
age: ";
cin >> age;
Your answer is incorrect.
The correct answer is:
int age = 0;
cout << "Please enter your age: ";
cin >> age;
Question 8
Correct
Mark 1.00 out of 1.00
Which C++ statement is the equivalent of
the following statement using a single
arithmetic assignment operator?
sum = sum + 47;
a. sum += 47;
b. sum == 47;
c. sum +47;
d. sum += sum;
Your answer is correct.
The correct answer is:
sum += 47;
https://mymodules.dtls.unisa.ac.za/mod/quiz/review.php?attempt=16709304&cmid=959160 4/33