WorksheetsFinal Exam - BECC0302
Total questions: 35
Worksheet time: 48mins
What is the full name of your instructor in BECC0302?
(a)
Definition of programming language.
A language used by machines to communicate with aliens.
A language used by humans to communicate with machines.
A language used to operate a machine.
A language used to create a machine.
IDE stands for?
(a)
The output or print function used in C++.
(a)
The input function used in C++.
(a)
Terminator symbol used in C++.
(a)
Complete this statement to display the text.
cout ____ "Level Completed!";
<<
++
>>
( )
An allocated storage in a programming language that stores values like text and numbers.
variable
constant
variety
data type
Which of the following options has a correct variable name?
employeeName
34empName
$empname
employee ID
A variable's value cannot change during the execution of the program.
True
False
What is the output of this code?
string x = "a";
x = "b";
cout << x;
x = "c";
cout << x;
bc
abc
cb
ab
Integer is a data type used to store numbers with decimal points.
True
False
Double data type is precise compared to float.
True
False
This data type is used to store variable character sequence.
(a)
Boolean has only two values: true and false. In which of the following does this two values corresponds to when we execute a program containing a boolean?
1 and 0
True and False
Yes and No
Nothing corresponds to the values.
What is the output of this code?
int x = 4;
int y = 2;
int z = 1;
cout << x+y+z+x;
(a)
What would be the output of this code?
int price = 78, discount = 15;
int total = price - discount;
cout << total;
63
65
66
60
Complete the given code snippet to be able to compute for the area.
double length, width;
cin >> length;
cin >> width;
double area = (a) ;
cout << area;
When separating multiple variable declarations with a comma, they need to . . . ?
have the same type
be integers
be named x and y
have the same value
What is the value of the variable based on the code snippet?
auto percentage = 3.1415;
cout << "Your daily increase is " << percentage;
double
integer
string
void
Is this code valid?
auto name;
name = "Jose Carlo";
Yes, because there is a proper variable declaration.
No, because the auto keyword assigns data type based on initialized value.
Yes, because the statements both have terminator symbols.
No, because 'Jose Carlo' is not a proper name.
Do you think the given code snippet will have a proper result or not?
string studentName;
cin >> studentname;
cout << "Welcome, " << studentName << "!" << endl;
Yes, it will yield a proper result.
Yes, but the input function will not execute.
No, because there's no value initialized.
No, because the variable call is not the same with the declaration.
int average = 86;
if(average >= 75 && average <= 89)
cout << "You passed the exams!";
Is the condition true of false?
True
False
int num = 12;
if(num != 12)
cout << "Wrong number!";
Is the condition true or false?
True
False
for(int a=1; a<6; a++)
cout << a << endl;
What will be the output of the code?
1
2
3
4
5
1
3
5
7
9
6
12345
for(int a=1; a<=10; a++)
int b = a % 2;
if(b != 1)
cout << a << endl;
What will be the output of the code?
2
4
6
8
10
1
3
5
7
9
1
2
3
4
5
10
9
8
7
6
int a = 5;
while(a > 0)
cout << a << endl;
a--;
What will be last result after executing this code?
1
2
4
5
int num = 0;
do
cout << num << endl;
num+=2;
while(num <= 10);
What is the fourth output after executing this code?
2
4
5
6
Array is a collection of values assigned under one name.
True
False
int num[5] = {12, 13, 41, 51, 26};
cout << num[2] + num[0];
What will be the output of the code?
(a)
int age[] = {24, 23, 26, 25, 24, 28};
age[1]++;
cout << age[0] + age[5];
What wil be the output of the given code?
(a)
string names[] = {"Carlo", "Jemuel", "Greg", "Miles", "Olivia", "Jerard"};
cout << names[3];
Change the value 'Olivia' to 'Oliver'. Write your answer/ code.
(a)
What will be the output of this code?
(a)
What will be the output of this code?
(a)
int arr[] = {1, 2, 3, 4, 5};
int *ptr = arr;
arr[2] is the same as . . .
*(ptr+2)
ptr+2
*ptr+2
*ptr[2]
