...

Thursday 4 December 2014

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<iostream>
using namespace std;
int main()
{
    int a;
    cout<<a;
    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)

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Favorites More

 
Design by MA Technologies | Bloggerized by Computer Science Prevails