Friday, September 6, 2013

MCQ (C/C++ Programming Language) COMPUTER SCI.& APPLICATION -6

Multiple Choice Questions of C, C++ Programming Language
8-1. In C/CPP Programming strcmp() function is used for
A. Convert String to Char
B. Copy two Strings
C. Compare two Strings
D. None of these
8-2. In C/CPP Programming ‘\a’ is used for
A. Form feed
B. Line Brake
C. Select All
D. Alarm
8-3. Which of the following is the correct statement?
A. Variable name must start with underscore
B. Variable name must have digit
C. Variable name must have white space character
D. Keyword can not be a variable name
8-4. While coding in C/CPP Programming for “Call by Reference” we pass
A. Address of variable
B. Value of the variable
C. Either Value or Address
D. Both value and address
8-5. Which of the following is the symbol for AND operator?
A. ||
B. &
C. &&
D. $$
8-6. Which of the following is not the type of variable?
A. Extrern
B. Register
C. Global
D. None of above
8-7. Which of the following is the incorrect statement?
A. All array variables have same type
B. An array is the collection of variables
C. Array variables can be used individually
D. None of these
8-8. In C/CPP Programming array index is always starts from
A. 09/6/13 MultipleChoiceQuestions (MCQ) of C / C++ Programming | MCQQuestions
mcqquestions.com/multiple-choice-questions-of-c-cpp-programming-language-set-8 3/6
8
B. 1
C. 2
D. 3
8-9. In C/CPP Programming a function can return
A. Single value
B. Double Values
C. Many values
D. None of these
8-10. Which of the following is required to write and run C/CPP program?
A. Compiler
B. Text editor
C. Operating system
D. All of above
 Answers
1 – C / 2 – D / 3 – D / 4 – A / 5 – C / 6 – D / 7 – D / 8 – A / 9 – A / 10 – D

Multiple Choice Questions of C, C++ Programming Language
7-1 Which of the following is/are storage class
A. Automatic
B. Static
C. Allocated
D. All of Above
7-2 What will the output of following code
{
int x = 10, y = 15;
x = x++;
y = ++y;
printf(“%d, %d \n”, x, y);
}
A. 10, 15
B. 10, 16
C. 11, 16
D. 11, 15
7-3 NULL Pointer can be used as
A. To stop indirection in a recursive data structure
B. As an error value
C. As a sentinel Value
D. All of Above
7-4 Which one of the following is not the advantages of functions?
A. Debugging is easier
B. Testing is easier
C. Recursive call is possible
D. It consumes low disk space
7-5 What is the result of the following statement?
x = y = z = 0;
A. x = 0, y = Null, z = Null
B. x = 0, y = 0, z = 0
C. x = 0, y = 1, z = 2
D. the statement is incorrect
7-6 What is the result of the following statement?
X = 10;
y = ++x;
A. x = 10, y = 109/6/13 MultipleChoiceQuestions (MCQ) of C / C++ Programming | MCQQuestions
mcqquestions.com/multiple-choice-questions-of-c-cpp-programming-language-set-7 3/7
13
B. x = 10, y = 11
C. x = 11, y = 10
D. x = 11, y = 11
7-7 Which of the following statement creates infinite loop?
A. for ( ; ; )
B. while ( ; ; )
C. when ( ; ; )
D. if( ; ; )
7-8 The use of “break” Statement
A. to terminate a case in the switch statement
B. to force immediate termination of a loop
C. Both A & B
D. Only A
7-9 to use the function tolower(), which of the following header file should include
A. string.h
B. conio.h
C. ctype.h
D. Don’t need any header file
7-10 What is the function overloading?
A. Calling a function from another function
B. Having more than one functions ofsame name
C. Calling a function from itself
D. There is no such term in C/C++
 Answers
1 – D / 2 – C / 3 – D / 4 – D / 5 – B / 6 – D / 7 – A / 8 – C / 9 – C / 10 – B

5.1 By default, members of a C++ class are:
a. Private
b. Public
c. Protected
d. None of the above
5.2 Which of the following statements is true in C++?
► MCQ ► Inheritance ► C++ ► Function
1 12 29/6/13 MultipleChoiceQuestions (MCQ) of C / C++ Programming | MCQQuestions
mcqquestions.com/multiple-choice-questions-of-c-cpp-programming-language-set-5 2/5
a. A struct cannot have member functions.
b. A struct cannot have private members.
c. The default access modifier ofstruct is public.
d. None of the above.
5.3 C++ supports:
a. Multiple inheritance
b. Pointer to functions
c. Recursion
d. All of the above
5.4 Which of the following is not a C++ keyword?
a. Extern
b. Auto
c. Inherits
d. None of the above
5.5 Which of the following is not a bitwise operator?
a. &&
b. <<
c. ~
d. ^
5.6 In C++, the expression 5/2 is evaluated to:
a. 2.5
b. 2
c. 3
d. None of the above
5.7 In C++, the string literal “C++” occupies exactly ………. of memory.
a. 3 bytes
b. 4 bytes
c. 5 bytes
d. 6 bytes
5.8 In C++, generic functions are created using the keyword:
a. Generic
b. Template
c. Class
d. Type
5.9 The implicit argument passed to a member function of a c++ class is called:
a. “implicit” pointer
b. “sender” object
c. “this” pointer
d. “me” object
5.10 The default copy constructor performs:
a. Deep copy
b. Shallow copy
c. Hard copy
d. Soft copy
Answers
1 – A / 2 – C / 3 – D / 4 – C / 5 – A / 6 – B / 7 – B / 8 – B / 9 – C / 10 – B

4.1 Which of the following function that must contain in all C++ programs?
a. start()
b. system()
c. main()
d. program()
4.2 What punctuation must use to end the code C/C++ expression statement?
► MCQ ► Test Quiz ► Visual C++ ► Code C++
1 7 29/6/13 MultipleChoiceQuestions (MCQ) of C / C++ Programming | MCQQuestions
mcqquestions.com/multiple-choice-questions-of-c-cpp-programming-language-set-4 2/5
a. . (dot)
b. ; (semi-colon)
c. :(colon)
d. ‘ (single quote)
4.3 What symbol must use to signal the begaining and ending of code blocks or compound statements?
a. { }
b. -> and <-
c. BEGIN and END
d. ( and )
4.4 Which of the following is a correct comment for comment in C programs?
a. */ Comments */
b. ** Comment **
c. /* Comment */
d. { Comment }
4.5 What value will 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.
4.6 Which one of the following is the correct operator to compare two variables?
a. :=
b. =
c. equal
d. ==
4.7 Which one of the following is not a correct variable type in C++ programs?
a. float
b. real
c. int
d. double
4.8 The directives for the preprocessors begin with
a. Ampersand symbol(&)
b. Two Slashes (//)
c. Number Sign (#)
d. Less than symbol(<)
4.9 The header file iostream includes
a. The declarations of the basic standard input-output library.
b. The streams of includes and outputs of program effect.
c. Both of these
d. None of these
4.10 Which one of the following is the boolean operator for logical and?
a. &
b. &&
c. |
d. |&
Answers
1 – C / 2 – B / 3 – A / 4 – C / 5 – C / 6 – D / 7 – B / 8 – C / 9 – A / 10 – B


No comments: