Who developed C language?
Bjarne Stroustrup
Determines how we organize the elements in our code to make it legible to the computer. If there’s a syntax error, the computer might not be able to read it.
Syntax
A container (storage area) to hold data.
Variable/Variables
Is used in a programming language to control the flow of the program.
Control Statement
What is the main difference between C and C++?
The main difference between C and C++ is that C++ support classes and objects
How many times C++ programming language was updated?
4
Give one example of what programming syntax can determine.
Stores floating point numbers, with decimals.
Double
What is the syntax for switch case statement?
switch(expression)
{
case value1:
//code should be executed;
break;
case value2:
//code should be executed;
break;
…
Default:
//Code to execute if not all cases matched
break;
}
Are also a form of interaction between the computer and the user.
Output
Which programming language that has the OOP features of C++?
Simula67
The compiler considers these as non-executable statements.
Comment
Stores single characters, such as 'a' or 'B'.
char
What is the syntax for if statement?
if(condition)
{
//code should be executed;
}
Are text notes added to the program to provide explanatory information about the source code.
Comments
As C++ is close to ____ and ____, it makes it easy for programmers to switch to C++ or vice versa.
C# and Java
A mixture of natural language and high-level programming language.
Pseudocode
All C++ variables must be identified with unique names. These unique names are called ____ .
Identifiers
What is the syntax for for loop control statement?
for(initialization; condition; incr/decr){
//code should be executed;
}
Give at least one rule for naming a variable.
Enumerate the four primary features of OOP that supports C++.
Encapsulation, Polymorphism, Abstraction, and Inheritance
Is used by the programmer to make others understand his/her intent. It contains the summary of the code.
Code description
This will declare the variable as "constant", which means unchangeable and read-only.
const
What is the syntax for nested for loop?
for (initialization; condition; increment) {
for (initialization; condition; increment) {
// set of statements for inner loop
}
//set of statement for outer loop
}
Write the source code of the display output.
1-1
1-2
1-3
2-1
2-2
2-3
3-1
3-2
3-3
#include <iostream>
using namespace std;
int main(){
for (int x = 1; x <= 3; x++){
for(int y = 1; y <=3; y++)
{
cout << x << "-" << y "\n";
}
}
}