C Programming Multiple Choice Question


Q1. C Programming Language is often called as :

a) High Level Language
b) Middle Level Language
c) Low Level Language
d) None of these

Ans: b

Q2. Which of the following is true about C programming language ?

a) C is a structural language.
b) C is a procedural language.
c) C does not supports function within function.
d) All of these

Ans: d

Q3. How many keywords are there in C programming language ?

a) 32
b) 28
c) 21
d) None of these

Ans: a

Q4. Which is not the extended keyword in C ?

a) _Imaginary
b) _Complex
c) inline
d) None of these

Ans: d

Q5. Process in which source code is combined with object code
is termed as :

a) Linker
b) Loading
c) Linking
d) None of these

Ans: c

Q6. An object of type ‘char’ is of :

a) 1 byte
b) 2 bytes
c) 4 bytes
d) 8 bytes

Ans: a

Q7. For 32 bits environment, size of ‘int’ data type is :

a) 2 bytes
b) 4 bytes
c) 8 bytes
d) None of these

Ans: b

Q8. What is the minimal range of unsigned char data type ?

a) -127 to 127
b) 0 to 255
c) -32767 to 32767
d) None of these

Ans: a

Q9. In C, the names of variables, functions, labels, and various
other user-defined items are :

a) keywords
b) Tokens
c) Identifiers
d) None of these

Ans: c

Q10. Variables that are declared inside a function are :

a) constants
b) literals
c) global
d) local

Ans: d

Q11. All non-global variables are by default :

a) auto
b) static
c) extern
d) register

Ans: a

Q12. You can direct the compiler to retail the values of local
variables using ______ modifier.

a) auto
b) static
c) extern
d) register.

Ans: b

Q13. main() is :

a) keyword
b) function
c) both
d) None of these

Ans: b


Q14. This modifier tells the compiler that the value of the variable
may change at any time – without any action being taken by the
code the compiler finds nearby.

a) extern
b) public
c) void
d) volatile

Ans: d

Q15. Variables with __ keyword are only declared not defined.

a) auto
b) extern
c) static
d) register

Ans: b

Q16. Which of the following statement about ‘static variables’ is
false ?

) Static variables are permanent variables within their own function or file.
b) Static local variables are not known outside the function or file.
c) Static variables maintain their values during function calls.
d) Static variables and global variables are same.

Ans: d

Q17. Which operator is used to return the length of the variables
in bytes ?

a) size()
b) length()
c) leng()
d) sizeof()

Ans: d

Q18. The format identifier ‘%i’ is also used for :

a) char
b) int
c) float
d) double

Ans: b

Q19. Which data type is best for storing a number 65000 in a 32-
bit system ?

a) int
b) long
c) signed short
d) unsigned short

Ans: d

Q20. Which header file can be used to define i/o function
prototypes and macros?

a) stdio.h
b) conio.h
c) stdlib.h
d) alloc,h

Ans: a

Q21. Which of the following is an invalid if-else statement ?

a) if (if (a == 1)){}
b) if (func1 (a)){}
c) if (a){}
d) if ((char) a){}

Ans: a

Q22. According to ANSI specification, how to declare main ()
function with command-line arguments ?

a) int main(int argc, char *argv[])
b) int char main(int argc, *argv)
c) Both of the above
d) None of the above

Ans: a

Q23. const int *ptr;. Which statement is true ?

a) You cannot change the value pointed by ptr
b) You cannot change the pointer ptr itself
c) You May or may not change the value pointed by ptr
d) You can change the pointer as well as the value pointed by it

Ans: a

Q24. ______ is used to break out of a program ?

a) break
b) continue
c) terminate
d) exit

Ans: d

Q25. Which is an indirection operator among the following?

a) &
b) $
c) *
d) .

Ans: c

Q26. Which of the following does not initialize ptr to null (assume
a = 0) ?

a) int *ptr = &a;
b) int *ptr = &a – &a;
c) int *ptr = a – a;
d) All of the mentioned

Ans: a

Next »


Leave a Reply

Your email address will not be published. Required fields are marked *