Unlimited Online Free Software Download! Get 100% Free Hurry up!

C & C++ Quiz


Q. 1   What is the 16-bit compiler allowable range for integer constants ?

-32768 to 32767

Q. 2   What is required in each C program ?

The program must have at least one function.

Q. 3   Which of the following comment is correct when a macro definition includes arguments ?

The opening parenthesis should immediately follow the macro name.

Q. 4   What is a lint ?

Analyzing tool

Q. 5   What is the output of this statement ''printf(''%d'', (a++))'' ?

The current value of a

Q. 6   Why is a macro used in place of a function ?

It reduces execution time.

Q. 7   In the C language, the constant is defined _______.

Anywhere, but starting on a new line.

Q. 8   A pointer is a memory address. Suppose the pointer variable has p address 1000, and that p is declared to have type int*, and an int is 4 bytes long. What address is represented by expression p + 2 ?


Q. 9   Which one of the following is a loop construct that will always be executed once ?

do while

Q. 10   How many characters can a string hold when declared as follows ? char name[20]:


Q. 11   Directives are translated by the


Q. 12   How many bytes does **int = D** use ?

2 or 4

Q. 13   What is the maximum number of characters that can be held in the string variable char address line [40] ?


Q. 14   Which one is the correct description for the variable balance declared below ? int ** balance;

Balance is a pointer to a pointer to an integer

Q. 15   Which of the following statement is not true ?

A pointer must point to a data item on the heap (free store).

Q. 16   Let p1 be an integer pointer with a current value of 2000. What is the content of p1 after the expression p1++ has been evaluated ?


Q. 17   Let p1 and p2 be integer pointers. Which one is a syntactically wrong statement ?

p1 = p1 + p2;

Q. 18   Suppose that cPtr is a character pointer, and its current content is 300. What will be the new value in cPtr after the following assignment ? cPtr = cPtr + 5;


Q. 19   Which is valid expression in C language ?

int my_num = 100000;

Q. 20   If addition had higher precedence than multiplication, then the value of the expression (1 + 2 * 3 + 4 * 5) would be which of the following ?


Q. 21   Who is the father of C language ?

Dennis Ritchie

Q. 22   All keywords in C are in ____________

LowerCase letters

Q. 23   Which of the following is true for variable names in C ?

Variable names cannot start with a digit

Q. 24   Which of the following cannot be a variable name in C ?


Q. 25   Which of the following declaration is not supported by C language ?

String str;

Q. 26   Which keyword is used to prevent any changes in the variable within a C program ?


Q. 27   What is the result of logical or relational expression in C ?

0 or 1

Q. 28   Where in C the order of precedence of operators do not exist ?

None of the mentioned

Q. 29   What is an example of iteration in C ?

all of the mentioned

Q. 30   Functions can return enumeration constants in C ?


Q. 31   Functions in C Language are always _________


Q. 32   Which of following is not accepted in C ?

static static int a; //a static variable prefixed with static

Q. 33   Property which allows to produce different executable for different platforms in C is called ?

Conditional compilation

Q. 34   What is #include ?

Preprocessor directive

Q. 35   C preprocessors can have compiler specific features.


Q. 36   The C-preprocessors are specified with _________ symbol.


Q. 37   How many number of pointer (*) does C have against a pointer variable declaration ?

No limits

Q. 38   Which of the following is not possible statically in C language ?

Jagged Array

Q. 39   which of the following return-type cannot be used for a function in C ?

none of the mentioned

Q. 40   When a C program is started, O.S environment is responsible for opening file and providing pointer for that file ?

All of the mentioned

Q. 41   In C language, FILE is of which data type ?


Q. 42   What is the sizeof(char) in a 32-bit C compiler ?

1 Byte

Q. 43   scanf() is a predefined function in______header file.

stdio. h

Q. 44   C Language develop at‌‌‌‌______?

AT & T's Bell Laboratories of USA in 1972

Q. 45   C programs are convert into machine language with help of

A compiler

Q. 46   C was primarily Developed as

System programming language

Q. 47   Standard ANSI C recongnizes________number of keyboards ?


Q. 48   C Language is a successor to which language ?

B Language

Q. 49   C is a which level language ?

High Level

Q. 50   Low level language is ?

Difficult to understand and readability is questionable.

Q. 51   High level language is a ?

Human readable like language.

Q. 52   C is _______ type of programming language ?


Q. 53   Who invented C++ ?

Bjarne Stroustrup

Q. 54   Which of the following is used for comments in C++ ?

both // comment or /* comment */

Q. 55   Which of the following is not a type of Constructor in C++ ?

Friend constructor

Q. 56   Which of the following type is provided by C++ but not C ?


Q. 57   Which of the following correctly declares an array in C++ ?

int array[10];

Q. 58   What is Inheritance in C++ ?

Deriving new classes from existing classes

Q. 59   What is meant by a polymorphism in C++ ?

class having many forms

Q. 60   What is abstract class in C++ ?

Class specifically used as a base class with atleast one pure virtual functions

Q. 61   Which of the following constructors are provided by the C++ compiler if not defined in a class ?

Default constructor

Q. 62   The operator used for dereferencing or indirection is ____


Q. 63   What will happen in the following C++ code snippet ?
1. int a = 100, b = 200;
2. int *p = &a, *q = &b;
3. p = q;

p now points to b

Q. 64   Which operator is used to signify the namespace ?

scope-resolution operator

Q. 65   What does a class in C++ holds ?

both data & functions

Q. 66   Which other keywords are also used to declare the class?


Q. 67   The data members and functions of a class in C++ are by default ____________


Q. 68   Constructors are used to ____________

initialize the objects

Q. 69   Which of these following members are not accessed by using direct member access operator ?

both private & protected

Q. 70   How many objects can present in a single class ?

as many as possible

Q. 71   Which special character is used to mark the end of class ?


Q. 72   Which of the following operators can't be overloaded ?


Q. 73   Which keyword is used to represent a friend function ?


Q. 74   What is a friend function in C++ ?

A function which can access all the private, protected and public members of a class

Q. 75   What is a function template ?

creating a function without having to specify the exact type

Q. 76   What is the syntax of class template ?

template <paramaters> class declaration

Q. 77   What is meant by multiple inheritance ?

Deriving a derived class from more than one base class

Q. 78   What is the type of inheritance in the following C++ code ?
1. #include <iostream>
2. using namespace std;
3. class student
4. {
5. public:
6. int rno , m1 , m2 ;
7. };
8. class sports
9. {
10. public:
11. int sm;
12. };
13. class statement : public student, public sports
14. {
15. int tot,avg;
16. };
17. int main()
18. {
19. statement obj; 20. }

Multiple inheritance

Q. 79   Which of the following is the correct syntax to print the message in C++ language ?

cout <<"Hello world!";

Q. 80   Which of the following is the address operator ?


Q. 81   For inserting a new line in C++ program, which one of the following statements can be used ?


Q. 82   Which of the following refers to characteristics of an array ?

An array is a set of similar data items

Q. 83   If we stored five elements or data items in an array, what will be the index address or the index number of the array's last data item ?


Q. 84   Wrapping data and its related functionality into a single entity is known as _____________


Q. 85   How many types of polymorphism are there in C++ ?


Q. 86   Which of the following is not a type of inheritance ?


Q. 87   Which of the following is called insertion operator ?


Q. 88   Which of the following is called extraction operator ?


Q. 89   What is the size of a boolean variable in C++ ?

1 bit

Q. 90   Which of the following is C++ equivalent for scanf() ?


Q. 91   Which of the following is the scope resolution operator ?


Q. 92   What is std in C++ ?

std is a standard namespace in C++

Q. 93   Which of the following accesses the seventh element stored in array ?


Q. 94   What will be the output of the following C++ code ?
1. #include <iostream>
2. using namespace std;
3. int main()
4. {
5. int a = 21;
6. int c ;
7. c = a++;
8. cout << c;
9. return 0;
10. }


Q. 95   What will be the output of the following C++ code ?
1. #include <iostream>
2. using namespace std;
3. int main()
4. {
5. int num1 = 5;
6. int num2 = 3;
7. int num3;
8. num3 = ++num2
9. cout < num3
10. return 0;
11. }


Q. 96   What is the type of inheritance in the following C++ code ?
1. #include <iostream>
2. using namespace std;
3. class A
4. {
5. float d;
6. };
8. class B: public A
9. {
10. int a = 15;
11. };
13. int main()
14. {
15. B b;
16. return 0;
17. }

Single inheritance

Q. 97   What do vectors represent ?

Dynamic arrays

Q. 98   Where does the execution of c++ program starts ?

main() function

Q. 99   Which of the following correctly declares an array ?

int array[10];

Q. 100   Which data type is used to represent the absence of parameters ?


Q. 101   The value 132.54 can be represented using which data type ?


Q. 102   What is syntax of defining a constructor of class A ?


Q. 103   Which function is used to open a file in C?


Q. 104   Which is the correct syntax to declare a file pointer in C?

FILE *file_pointer;

Q. 105   Header files ___.

All of these

Q. 106   The sqrt() function is used to calculate which value?

Square root

Q. 107   A recursive function in C ___.

Call itself again and again

Q. 108   A ___ can be assigned the address of any data type.

Void pointer

Q. 109   What will be the output of the following C code?
int main(){
int x = 10, *ptr;
ptr = &x;
*ptr = 20;
printf("%d", x);


Q. 110   Before using a pointer variable, it should be ___.

Both A. and B.

Q. 111   Which of the following is the collection of different data types?


Q. 112   The size of a union is ___.

Equal to size of largest data type

Q. 113   Which feature of OOPS described the reusability of code?


Q. 114   A single program of OOPS contains _______ classes?

Any number

Q. 115   Which operator from the following can be used to illustrate the feature of polymorphism?

Overloading <<

Q. 116   Which header file is required by the C++ programming language to use the OOPS concept?

We can easily use the OOPS concepts in c++ programs without using any header file

Q. 117   Which function best describe the concept of polymorphism in programming languages?

Virtual function

Q. 118   Which of the following feature is also known as run-time binding or late binding?

Dynamic binding

Q. 119   What is the output of this program?

using namespace std;
int main()
int x = 3, k;
while (x-- >= 0) {
printf("%d ", x);
return 0;

2 1 0 -1

Q. 120   What is the output of this program?
using namespace std;
int main()
int x = -10;
while (x++ != 0)
printf("%d ", x);
return 0;