Ques 1 Syntax
Which of the following is the correct way to declare an integer variable named "num" in C++?
b) integer num; - This is incorrect because "integer" is not a valid data type in C++. The correct keyword for integers is "int".
c) num = int; - This is incorrect because it is assigning the keyword "int" to the variable "num". The correct way to initialize a variable is to assign a value to it, not a data type.
d) declare num as integer; - This is not a valid C++ syntax. To declare a variable, you need to use the appropriate keyword (in this case, "int") followed by the variable name.
So, a) is the correct option
Ques 2 Syntax
How do you initialize an array of integers named "arr" with values 1, 2, 3, and 4 in C++?
Ques 3 Syntax
In C++, how can you pass the address of a variable to a function?
Ques 4 Syntax
What is the purpose of the "const" keyword in C++?
The const keyword in C++ is used to declare variables or objects whose values cannot be modified after initialization. This helps prevent accidental changes to important data and improves code reliability.
So, d) It indicates that a variable's value cannot be changed. is correct answer.