Quiz -- C++ Basics - WOSTWARELD

Breaking

Saturday, December 3, 2016

Quiz -- C++ Basics

1. What is the correct value to return to the operating system upon the successful completion of a program?
A. -1
B. 1
C. 0
D. Programs do not return a value.

2. What is the only function all C++ programs must contain?
A. start()
B. system()
C. main()
D. program()

3. What punctuation is used to signal the beginning and end of code blocks?
A. { }
B. -> and <-
C. BEGIN and END
D. ( and )

4. What punctuation ends most lines of C++ code?
A. .
B. ;
C. :
D. '

5. Which of the following is a correct comment?
A. */ Comments */
B. ** Comment **
C. /* Comment */
D. { Comment }

6. Which of the following is not a correct variable type?
A. float
B. real
C. int
D. double

7. Which of the following is the correct operator to compare two variables?
A. :=
B. =
C. equal
D. ==


8. Which of the following statement is correct?
A. C++ enables to define functions that take constants as an argument.
B. We cannot change the argument of the function that that are declared as constant.
C. Both A and B.
D. We cannot use the constant while defining the function.

9. How much memory an integer, double, float and character takes to store the value?
A. 4 bytes, 8 bytes, 4 bytes and 1 byte
B. 4 bytes, 4 bytes, 8 bytes and 2 bytes
C. 2 bytes, 8 bytes, 8 bytes and 4 byte
D. 2 or 4 bytes, 8 bytes, 8 bytes and 1 byte


10. What will be the output?
   


#include
using namespace std;
int main()
{
    int a;
    cout<    return 0;
}



A. Unidentified Integer Error
B. Compile Error
C. Run-time Error
D. Garbage Value



















ANSWER KEY

1. (C)   2. (C)   3. (A)   4. (B)   5. (C)   6. (B)   7. (D)   8. (C)   9. (A)   10. (D)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.

zz