1.
Which of the following function that must contain in all C++ programs?
Correct Answer
C. Main ( )
Explanation
The main() function is a required function in all C++ programs. It serves as the entry point of the program, where the execution begins. Without the main() function, the program will not run or produce any output. Therefore, the main() function must be present in all C++ programs.
2.
What punctuation must use to end the code C/C++ expression statement?
Correct Answer
B. ; (semi-colon)
Explanation
In C/C++ programming, a semi-colon (;) must be used to end a code expression statement. This punctuation marks the end of a statement and allows the compiler to understand the boundaries of each expression. Not using a semi-colon can result in a syntax error and the code may not compile correctly.
3.
What symbol must use to signal the begaining and ending of code blocks or compound statements?
Correct Answer
A. { }
Explanation
The symbols { } must be used to signal the beginning and ending of code blocks or compound statements. These curly brackets are commonly used in programming languages like C, C++, Java, and JavaScript to enclose a group of statements and define the scope of the code block. The opening curly bracket { marks the start of the block, and the closing curly bracket } indicates the end of the block.
4.
Which of the following is a correct comment for comment in C programs?
Correct Answer
C. /* Comment */
Explanation
The correct comment for commenting in C programs is /* Comment */. This is the standard way to write comments in C programming language. Comments are used to add explanatory notes to the code, which are ignored by the compiler. They help in making the code more readable and understandable for other programmers who may work on the code in the future.
5.
What value will return to the operating system upon the successful completion of a program?
Correct Answer
C. 0
Explanation
Upon the successful completion of a program, a value of 0 will return to the operating system. This is a common convention in programming where a return value of 0 indicates that the program executed successfully without any errors or issues.
6.
Which one of the following is the correct operator to compare two variables?
Correct Answer
D. = =
Explanation
The correct operator to compare two variables is "==" in most programming languages. This operator checks if the values of the two variables are equal. The "==" operator returns true if the values are equal and false otherwise.
7.
Which one of the following is not a correct variable type in C++ programs?
Correct Answer
B. Real
8.
The directives for the preprocessors begin with
Correct Answer
C. Number Sign (#)
Explanation
The correct answer is the number sign (#). Preprocessor directives in programming languages, such as C or C++, typically start with a number sign (#). These directives are used to provide instructions to the preprocessor, which is a program that runs before the actual compilation of the code. The preprocessor performs tasks like including header files, defining constants, and performing conditional compilation. Therefore, the number sign is the correct symbol to indicate the beginning of a preprocessor directive.
9.
The header file iostream includes
Correct Answer
A. The declarations of the basic standard input-output library.
Explanation
The header file iostream includes the declarations of the basic standard input-output library. This means that when we include the iostream header file in our program, we gain access to the basic input and output functionalities provided by the C++ standard library. This includes features such as reading input from the keyboard and printing output to the console.
10.
Which one of the following is the boolean operator for logical and?
Correct Answer
B. & &
Explanation
The boolean operator for logical and is represented by the symbol "&". This operator is used to combine two or more conditions in a logical statement, and it returns true only if all the conditions are true.