Sie sind auf Seite 1von 15

BASICS OF C++

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. . (dot)
B. ; (semi-colon)
C. : (colon)
D. ' (single quote)
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 is true?
A. 1
B. 66
C. .1
D. -1
E. All of the above
9. Which of the following is the Boolean operator for logical-and?
A. &
B. &&
C. |
D. |&
10. Evaluate !(1 && !(0 || 1)).
A. True
B. False
C. Unevaluatable
1: Identify the correct statement
a. Programmer can use comments to include short explanations within the source code itself.
b. All lines beginning with two slash signs are considered comments.
c. Comments very important effect on the behavior of the program
d. both
2: The directives for the preprocessors begin with
a. Ampersand symbol (&
b. Two Slashes (//)
c. Number Sign (#)
d. Less than symbol (<
3: The 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: There is a unique function in C++ program by where all C++ programs start their execution
a. Start()
b. Begin()
c. Main()
d. Output()
5: Every function in C++ are followed by
a. Parameters
b. Parenthesis
c. Curly braces
d. None of these
6: Which of the following is false?
a. Cout represents the standard output stream in c++.
b. Cout is declared in the iostream standard file
c. Cout is declared within the std namespace
d. None of above
7: Every statement in C++ program should end with
a. A full stop (.)
b. A Comma (,)
c. A Semicolon (
d. A colon (
8: Which of the following statement is true about preprocessor directives?
a. These are lines read and processed by the preprocessor
b. They do not produce any code by themselves
c. These must be written on their own line
d. They end with a semicolon
9: A block comment can be written by
a. Starting every line with double slashes (//)
b. Starting with /* and ending with */
c. Starting with //* and ending with *//
d. Starting with <!- and ending with -!>
10: When writing comments you can
a. Use code and /* comment on the same line
b. Use code and // comments on the same line
c. Use code and //* comments on the same line
d. Use code and <!- comments on the same line
1: A variable is/are
a. String that varies during program execution
b. A portion of memory to store a determined value
c. Those numbers that are frequently required in programs
d. None of these
2: Which of the following can not be used as identifiers?
a. Letters
b. Digits
c. Underscores
d. Spaces
3: Which of the following identifiers is invalid?
a. papername
b. writername
c. typename
d. printname
4: Which of the following can not be used as valid identifier?
a. bitand
b. bittand
c. biand
d. band
5: The difference between x and ‘x’ is
a. The first one refers to a variable whose identifier is x and the second one refers to the character constant x
b. The first one is a character constant x and second one is the string literal x
c. Both are same
d. None of above
6: Which of the following is not a valid escape code?
a. \t
b. \v
c. \f
d. \w
7: Which of the following statement is true?
a. String Literals can extend to more than a single line of code by putting a backslash sign at the end of each unfinished line.
b. You can also concatenate several string constants separating them by one or several blank spaces, tabulators, newline or any
other valid blank character
c. If we want the string literal to explicitly made of wide characters, we can precede the constant with the L prefix
d. All of above
8: Regarding #difine which of the following statement is false?
a. It is not C++ statement but the directive for the preprocessor
b. This does not require a semicolon at the end of line
c. It is a C++ statement that declares a constant in C++
d. None of the above
9: Regarding following statement which of the statements is true? const int pathwidth=100;
a. Declares a variable pathwidth with 100 as its initial value
b. Declares a construction pathwidth with 100 as its initial value
c. Declares a constant pathwidth whose value will be 100
d. Constructs an integer type variable with pathwidth as identifier and 100 as value
10: In an assignment statement
a. The lvalue must always be a variable
b. The rvalue might be a constant, a variable, an expression or any combination of these
c. The assignment always takes place from right to left and never the other way
d. All of above
1: In an assignment statement
a=b;
Which of the following statement is true?
a. The variable a and the variable b are equal.
b. The value of b is assigned to variable a but the later changes on variable b will not affect the value of variable a
c. The value of b is assigned to variable a and the later changes on variable b will affect the value of variable a
d. The value of variable a is assigned to variable b and the value of variable b is assigned to variable a.
2: All of the following are valid expressions in C++
a = 2 + (b = 5);
a = b = c = 5;
a = 11 % 3
a. True
b. False
3: To increase the value of c by one which of the following statement is wrong?
a. c++;
b. c = c + 1;
c. c + 1 => c;
d. c += 1
4: When following piece of code is executed, what happens?
b = 3;
a = b++;
a. a contains 3 and b contains 4
b. a contains 4 and b contains 4
c. a contains 4 and b contains 3
d. a contains 3 and b contains 3
5: The result of a Relational operation is always
a. either True or False
b. is less than or is more than
c. is equal or less or more
d. All of these
6: Which of the following is not a valid relational operator?
a. ==
b. =>
c. >=
d. >=
7: What is the final value of x when the code int x; for(x=0; x<10; x++) {} is run?
A. 10
B. 9
C. 0
D. 1
8: When does the code block following while(x<100) execute?
A. When x is less than one hundred
B. When x is greater than one hundred
C. When x is equal to one hundred
D. While it wishes
9: Which is not a loop structure?
A. for
B. do while
C. while
D. repeat until
10: How many times is a do while loop guaranteed to loop?
A. 0
B. Infinitely
C. 1
D. Variable
1: Streams are
a. Abstraction to perform input and output operations in sequential media
b. Abstraction to perform input and output operations in direct access media
c. Objects where a program can either insert or extract characters to and from it
d. Both a and c
2: Which of the following is known as insertion operator?
a. ^
b. v
c. <<
d. >>
3: Regarding the use of new line character (/n) and endl manipulator with cout statement
a. Both ways are exactly same
b. Both are similar but endl additionally performs flushing of buffer
c. endl can’t be used with cout
d. \n can’t be used with cout
4: Which of the following is output statement in C++?
a. print
b. write
c. cout
d. cin
5: Which of the following is input statement in C++?
a. cin
b. input
c. get
d. none of above
6: By default, the standard output device for C++ programs is
a. Printer
b. Monitor
c. Modem
d. Disk
7: By default, the standard input device for C++ program is
a. Keyboard
b. Mouse
c. Scanner
d. None of these
8: Which of the following statement is true regarding cin statement?
a. cin statement must contain a variable preceded by >> operator
b. cin does not process the input until user presses RETURN key
c. you can use more than one datum input from user by using cin
d. all of above
9: Which of the following is extraction operator in C++?
a. ^
b. v
c. <<
d. >>
10: When requesting multiple datum, user must separate each by using
a. a space
b. a tab character
c. a new line character
d. all of above

1: cin extraction stops execution as soon as it finds any blank space character
a. true
b. false
2: Observe the following statements and decide what do they do.
string mystring;
getline(cin, mystring);
a. reads a line of string from cin into mystring
b. reads a line of string from mystring into cin
c. cin can’t be used this way
d. none of above
3: Regarding stringstream identify the invalid statement
a. stringstream is defined in the header file <sstream>
b. It allows string based objects treated as stream
c. It is especially useful to convert strings to numerical values and vice versa.
d. None of above
4: Which of the header file must be included to use stringstream?
a. <iostream>
b. <string>
c. <sstring>
d. <sstream>
5: Which of the following header file does not exist?
a. <iostream>
b. <string>
c. <sstring>
d. <sstream>
6: If you use same variable for two getline statements
a. Both the inputs are stored in that variable
b. The second input overwrites the first one
c. The second input attempt fails since the variable already got its value
d. You can not use same variable for two getline statements
7: The “return 0;” statement in main function indicates
a. The program did nothing; completed 0 tasks
b. The program worked as expected without any errors during its execution
c. not to end the program yet.
d. None of above
8: Which of the following is not a reserve keyword in C++?
a. mutable
b. default
c. readable
d. volatile
9: The size of following variable is not 4 bytes in 32 bit systems
a. int
b. long int
c. short int
d. float
10: Identify the correct statement regarding scope of variables
a. Global variables are declared in a separate file and accessible from any program.
b. Local variables are declared inside a function and accessible within the function only.
c. Global variables are declared inside a function and accessible from anywhere in program.
d. Local variables are declared in the main body of the program and accessible only from functions.

1: Find out the error in following block of code.


If (x = 100)
Cout << “x is 100”;
a. 100 should be enclosed in quotations
b. There is no semicolon at the end of first line
c. Equals to operator mistake
d. Variable x should not be inside quotation
2: Looping in a program means
a. Jumping to the specified branch of program
b. Repeat the specified lines of code
c. Both of above
d. None of above
3: The difference between while structure and do structure for looping is
a. In while statement the condition is tested at the end of first iteration
b. In do structure the condition is tested at the beginning of first iteration
c. The do structure decides whether to start the loop code or not whereas while statement decides whether to
repeat the code or not
d. In while structure condition is tested before executing statements inside loop whereas in do structure
condition is tested before repeating the statements inside loop
4: Which of the following is not a looping statement in C?
a. while
b. until
c. do
d. for
5: Which of the following is not a jump statement in C++?
a. break
b. goto
c. exit
d. switch
6: Which of the following is selection statement in C++?
a. break
b. goto
c. exit
d. switch
7: The continue statement
a. resumes the program if it is hanged
b. resumes the program if it was break was applied
c. skips the rest of the loop in current iteration
d. all of above
8: Consider the following two pieces of codes and choose the best answer
Code 1:
switch (x) {
case 1:
cout <<”x is 1”;
break;
case 2:
cout <<”x is 2”;
break;
default:
cout <<”value of x unknown”;
}
Code 2 :
If (x==1){
Cout <<”x is 1”;
}
Else if (x==2){
Cout << “x is 2”;
}
Else{
Cout <<”value of x unknown”;
}
a. Both of the above code fragments have the same behaviour
b. Both of the above code fragments produce different effects
c. The first code produces more results than second
d. The second code produces more results than first.
9: Observe the following block of code and determine what happens when x=2?
switch (x){
case 1:
case 2:
case 3:
cout<< "x is 3, so jumping to third branch";
goto thirdBranch;
default:
cout<<"x is not within the range, so need to say Thank You!";
}
a. Program jumps to the end of switch statement since there is nothing to do for x=2
b. The code inside default will run since there is no task for x=2, so, default task is run
c. Will display x is 3, so jumping to third branch and jumps to third Branch.
d. None of above
10: Which of the following is false for switch statement in C++?
a. It uses labels instead of blocks
b. we need to put break statement at the end of the group of statement of a condition
c. we can put range for case such as case 1..3
d. None of above

1: The void specifier is used if a function does not have return type.
a. True
b. False
2: You must specify void in parameters if a function does not have any arguments.
a. True
b. False
3: Type specifier is optional when declaring a function
a. True
b. False
Question 4:
Study the following piece of code and choose the best answer
int x=5, y=3, z;
a=addition(x,y)
a. The function addition is called by passing the values
b. The function addition is called by passing reference
5: In case of arguments passed by values when calling a function such as z=addidion(x,y),
a. Any modifications to the variables x & y from inside the function will not have any effect outside the function.
b. The variables x and y will be updated when any modification is done in the function
c. The variables x and y are passed to the function addition
d. None of above are valid.
6: If the type specifier of parameters of a function is followed by an ampersand (& , that function call is
a. pass by value
b. pass by reference
7: In case of pass by reference
a. The values of those variables are passed to the function so that it can manipulate them
b. The location of variable in memory is passed to the function so that it can use the same memory area for its
processing
c. The function declaration should contain ampersand (& in its type declaration
d. All of above
8: Overloaded functions are
a. Very long functions that can hardly run
b. One function containing another one or more functions inside it.
c. Two or more functions with the same name but different number of parameters or type.
d. None of above
9: Functions can be declared with default values in parameters. We use default keyword to specify the value of
such parameters.
a. True
b. False
10: Examine the following program and determine the output
#include <iostream>
using namespace std;
int operate (int a, int b)
{
return (a * b);
}
float operate (float a, float b)
{
return (a/b);
}
int main()
{
int x=5, y=2;
float n=5.0, m=2.0;
cout << operate(x,y) <<"\t";
cout << operate (n,m);
return 0;
}
a. 10.0 5.0
b. 5.0 2.5
c. 10.0 5
d. 10 2.5
1. C++ is an extension of C with a major addition of the class construct feature of …………….
A) Simula67
B) Simula57
C) Simula47
D) Simula87
_____________________________________________________________________________________
2. C++ has the name ………………….. before it was changed to C++.
A) Improved C
B) Integrated C
C) C with classes
D) C with Simula
_____________________________________________________________________________________
3. …………. Refer to the names of variables, functions, arrays, classes etc. created by the programmer.
A) Keywords
B) Identifiers
C) Constraints
D) Strings
_____________________________________________________________________________________
4. In C++, the keyword void was used ………..
A) To specify the return type of function when it is not returning any value.
B) To indicate an empty argument list to a function.
C) To declare the generic pointers.
D) All of the above.
_____________________________________________________________________________________
5. Match the following
a) : : i) Pointer to member declarator
b) : :* ii) Pointer to member operator
c) ->* iii) Scope resolution operator
A) a-ii, b-iii, c-i
B) a-iii, b-i, c-ii
C) a-i b-ii, c-iii
D) a-iii, b-ii, c-i
_____________________________________________________________________________________
6. If m and n are int type variables, what will be the result of the expression
m% n when m=5 and n=2 ?
A) 0
B) 1
C) 2
D) None of the above
_____________________________________________________________________________________
7. Some of the C++ operators cannot overloaded which are
i) Member access operators (. And .*) ii) Conditional operator (? :)
iii) Scope resolution operator (: :) iv) Size operator (sizeof)
A) only i, ii and iii
B) only ii, iii and iv
C) only ii and iv
D) All i, ii, iii and iv
_____________________________________________________________________________________
8. Some of the situations where inline expansion may not work are:
A) For functions returning values, if a loop, a switch or goto exists.
B) If functions contain static variables and they are re-cursive.
C) For functions not returning values, if return statement exist.
D) All of the above.
_____________________________________________________________________________________
9. Which of the following control expressions are valid for an if statement?
A) an integer expression
B) a Boolean expression
C) either A or B
D) Neither A nor B
_____________________________________________________________________________________
10. …………… is a way to bind the data and its associated functions together which allows the data and functions to be
hidden.
A) Structure
B) Class
C) Enum
D) Both A and B
_____________________________________________________________________________________
11. When a function is defined inside a class, this function is called ………….
A) Inside function
B) Class function
C) Inline function
D) Interior function
_____________________________________________________________________________________
12. Which of the following cannot be passed to a function?
A) Reference variable
B) Arrays
C) Class objects
D) Header files
_____________________________________________________________________________________13. State true
of false.
i) We cannot make the function inline by defining a function outside the class.
ii) A member function can be called by using its name inside another member function of the same class, this is known
as nesting of member function.
A) True, True
B) True, False
C) False, True
D) False, False
_____________________________________________________________________________________
14. Which of the following operators could be overloaded?
A) Size of
B) +
C) +=
D) ::
_____________________________________________________________________________________
15. Which of the following is true about the static member variable in C++.
i) It is initialized to zero when the first object of its class is created. Other initialization is also permitted.
ii) It is visible only within the class, but its lifetime is the entire program.
A) i-True, ii-True
B) ii-False, ii-True
C) i-True, ii-False
D) i-False, iii-False
_____________________________________________________________________________________
16. Which of the following keywords are used to control access to a class member?
A) default
B) break
C) protected
D) goto
_____________________________________________________________________________________
17. What will be the values of x, m and n after execution of the following statements?
Int x, m, n;
m=10;
n=15;
x= ++m + n++;

A) x=25, m=10, n=15


B) x=27, m=10, n=15
C) x=26, m=11, n=16
D) x=27, m=11, n=16
_____________________________________________________________________________________
18. The major goal of inheritance in C++ is
A) To facilitate the conversion of data types
B) To help modular programming
C) To facilitate the re usability of code
D) To extend the capabilities of a class
_____________________________________________________________________________________
19. A variable is defined within a block in a body of a function. Which of the following are true?
A) It is visible throughout the function.
B) It is visible from the point of definition to the end of the program.
C) It is visible from the point of definition to the end of the block.
D) It is visible throughout the block.
_____________________________________________________________________________________
20. The friend functions are used in situations where
A) We want to exchange data between classes
B) We want to have access to unrelated classes
C) Dynamic binding is required
D) We want to create versatile overloaded operators.
1. C language has been developed by
A) Martin Richards
B) Bijarne Stroustrup
C) Dennis Ritche
D) Ken Thompson
_____________________________________________________________________________________
2. int[ ] ={5,6,7,8,9} What is the value of a[3]?
A) 9
B) 8
C) 7
D) 6
_____________________________________________________________________________________
3. C can be used on
A) Only MS-Dos operating System
B) Only Linux operating system
C) Only Windows operating system
D) All of the above
_____________________________________________________________________________________
4. Float a[15], what is the size of array?
A) 17
B) 14
C) 15
D) 16
_____________________________________________________________________________________
5. C programs are converted into machine language with the help of
A) An Editor
B) A complier
C) An operating system
D) None of the above
_____________________________________________________________________________________
6. Array is
A) Primary data type
B) Pointer data type
C) Heterogeneous data type
D) Homogenous data type
_____________________________________________________________________________________
7. Which of the following is allowed in a C Arithmetic Instruction?
A) [ ]
B) { }
C) ( )
D) None of the above
_____________________________________________________________________________________
8. To accept 100 different values into the array we require
A) Loop
B) If condition
C) Function
D) Structure
_____________________________________________________________________________________
9. If a is an integer variable, a=7/3; will return a value
A) 2.5
B) 3
C) 0
D) 2
_____________________________________________________________________________________
10. Pointer holds
A) Value of variable
B) Address of variable
C) Value and address of variable
D) Always null
_____________________________________________________________________________________
11. Hierarchy decides which operator
A) is most important
B) is used first
C) is fastest
D) Operates on largest numbers
_____________________________________________________________________________________
12. A pointer can hold
A) Single address at a time
B) Two addresses at a time
C) Number of addresses at a time
D) No address
_____________________________________________________________________________________
13. An integer constant in C must have
A) At least one digit
B) At least one decimal point
C) A comma along with digits
D) Digits separated by commas
_____________________________________________________________________________________
14. main () {
Int a=3, b=2, c*d*e;
d=&a; e=&b;
c=*d+*e;
}
Which one of the given answers is correct?
A) a=4, c-6
B) a=3, c=5
C) a=3, c=6
D) a=3, c=8
_____________________________________________________________________________________
15. In C a variable cannot contain
A) Blank Spaces
B) Decimal Point
C) Hyphen
D) All of the above
_____________________________________________________________________________________
16. Assume that variable x resides at memory location 1234, y at 1111 and p at 2222.
Int x=1, y=2, *p;
p=&x;
y=*p;
What will be the value of y after execution of above code?
A) 2
B) 1
C) 1234
D) 1111
_____________________________________________________________________________________
17. Which of the following is FALSE in C?
A) Keywords can be used as variable names
B) Variable names can contain a digit
C) Variable names do not contain a blank space
D) Capital letters can be used in variables

18. If an integer occupies 4 bytes and a character occupies 1 byte of memory, each element of the following structure
would occupy how many bytes ?
struct name {
int age;
char name[30];
};
A) 30
B) 32
C) 34
D) 36
_____________________________________________________________________________________
19. The expression x=4+2 % -8 evaluates to
A) -6
B) 6
C) 4
D) None of the above
_____________________________________________________________________________________
20. A structure brings together a group of
A) items of the same data type
B) related data items and variables
C) integers with user defined names
D) floating points with user defined names
_____________________________________________________________________________________
21. C language is available for which of the following operating systems?
A) DOS
B) Windows
C) Unix
D) All of the above
_____________________________________________________________________________________
22. Which of the following are tokens in C?
A) Keywords
B) Variables
C) Constraints
D) All of the above
_____________________________________________________________________________________
23. C was developed in the year .....................
A) 1970
B) 1972
C) 1976
D) 1980
_____________________________________________________________________________________
24. Which escape character can be used to beep from speaker in C?
A) \a
B) \b
C) \m
D) \n
_____________________________________________________________________________________
25. Which of the following is a keyword is used for storage class?
A) printf
B) external
C) auto
D) scanf
_____________________________________________________________________________________
26. Continue statement is used .............
A) to go to the next iteration in a loop
B) come out of a loop
C) exit and return to the main function
D) restarts iteration from beginning of loop
_____________________________________________________________________________________
27. File manipulation functions in C are available in which header file?
A) streams.h
B) stdio.h
C) stdlib.h
D) files.h
_____________________________________________________________________________________
28. A compiler ................
A) is a computer program
B) translates a high level language into machine language
C) is a part of software
D) editor
_____________________________________________________________________________________
29. Explicit type conversion is known as ....................
A) casting
B) conversion
C) disjunction
D) separation
_____________________________________________________________________________________
30. A function popularly used C input function
A) scanf
B) printf
C) getch
D) Char
_____________________________________________________________________________________
31. 'C' is often called a ....
A) Object oriented language
B) High level language
C) Assembly language
D) Machine level language
_____________________________________________________________________________________
32. Each C preprocessor directive begins with ....
A) #
B) include
C) main()
D) {
_____________________________________________________________________________________
33. C allows arrays of greater than two dimensions, who will determine this?
A) programmer
B) compiler
C) parameter
D) None of the above
_____________________________________________________________________________________
34. The << operator is used for
A) Right shifting
B) Left shifting
C) Bitwise shifting
D) Bitwise complement
_____________________________________________________________________________________
35. Set of values of the same type, which have a single name followed by an index is called
A) function
B) structure
C) array
D) union
_____________________________________________________________________________________
36. Which of the following header file is required for strcpy() function?
A) String.h
B) Strings.h
C) file.h
D) strcpy()
_____________________________________________________________________________________
37. scanf() can be used for reading ...
A) double character
B) single character
C) multiple characters
D) no character
_____________________________________________________________________________________
38. A variable which is visible only in the function in which it is defined is called
A) Static variable
B) auto variable
C) external variable
D) local variable
_____________________________________________________________________________________
39. In the loop structure logical expression is checked at the ....................of the loop.
A) first
B) end
C) middle
D) second
_____________________________________________________________________________________
40. If an array is used as function argument, the array is passed
A) by value
B) by reference
C) by name
D) the array cannot be used as function argument
_____________________________________________________________________________________
41. If is necessary to declare the type of function in the calling program if
A) Function returns an integer
B) Function returns a non-integer value
C) Function is not defined in the same file
D) Function is called number of times
_____________________________________________________________________________________
42. Which escape character can be used to begin a new line in C ........
A) \a
B) \m
C) \b
D) \n
_____________________________________________________________________________________
43. Input/output function prototypes and macros are defined in which header file?
A) conio.h
B) stdlib.h
C) stdio.h
D) dos.h
_____________________________________________________________________________________
44. What is the purpose of fflush() function?
A) flushes all streams and specified streams
B) flushes only specified stream
C) flushes input/output buffer
D) flushes file buffer
_____________________________________________________________________________________
45. What does the following declaration mean?int(*ptr)[10].
A) ptr is array of pointers to 10 integers.
B) ptr is a pointer to an array of 10 integers
C) ptr is an array of 10 integers
D) ptr is an pointer to array

1) 'C' allows a three way transfer of control with the help of


A. Unary Operator
B. Relational Operator
C. Ternary Operator
D. Comparison Operator

2) Operators have hierarchy. It is used to know which operator ....


A. is most important
B. is used first
C. is faster
D. operators on large numbers

3) The statement that transfers control to the beginning of the loop is called ..
A. break statement
B. exit statement
C. continue statement
D. goto statement

4) C programming language was developed by ..


A. Dennis Ritche
B. Ken Thompson
C. Bill Gates
D. Peter Norton

5) The value that follows the keyword CASE may only be


A. constants
B. variable
C. number
D. semicolon

6) In a C language 'a' represents ...


A. a digit
B. an integer
C. a character
D. a word

7) The statement which is used to terminate the control from the loop is
A. break
B. continue
C. goto
D. exit

8) The continue command cannot be used with ....


A. for
B. switch
C. do
D. while

9) A self contained block of statements that perform a coherent task of some kind is called a .
A. Monitor
B. Function
C. Program
D. Structure

10) Which among the following is a unconditional control structure?


A. do while
B. if else
C. goto
D. for

11) Recursion is sometimes called


A. Circular definition
B. Complex definition
C. Procedure
D. Union

12) Every program statement in a C program end with ...


A. semicolon
B. comma
C. full stop
D. slash

13) The loop in which the statements within the loop are executed at least once is called
A. do-while
B. while
C. for
D. goto

14) The maximum length allowed in specifying the name of a C variable is ........
A. 45
B. 31
C. 56
D. 78

15) The break statement causes an exit


A. Only from the innermost loop
B. Only from the innermost switch
C. From the innermost loop or switch
D. From the program

16) Which of the following is a unformatted console I/O function to get a string input?
A. puts
B. gets
C. clrscr
D. scanf

17) The operators << and >> are


A. assignment operator
B. relational operator
C. logical operator
D. bitwise shift operator

18) The operator & is used for ........


A. Bitwise AND
B. Bitwise OR
C. Logical AND
D. Logical OR

19) Which of the following is FALSE in C


A. Keywords can be used as variable names
B. Variable names can contain a digit
C. Variable names do not contain a blank space
D. Capital letters can be used in variable names

20) The operator && is an example of ........... operator.


A. assignment
B. increment
C. logical
D. relational

Das könnte Ihnen auch gefallen