C-Language MCQs > FREE SET - 2

1. The use of the break statement in a switch statement is
A optional
B compulsory
C not allowed. It gives an error message
D to check an error

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

2. Which type of statement does not occur in computer programs?
A sequence
B loop
C denial
D selection

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

3. The newline character is always included between
A pair of parentheses
B pair of curly braces
C control string
D &

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

4. A function that returns no values to the program that calls it is ________
A not allowed in C
B type void
C type empty
D type barren

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

5. The keyword used to define a structure is ________
A stru
B stt
C struct
D structure

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

6. Header files often have the file extension ________
A .H
B .HE
C .HEA
D .HEAD

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

7. The step-by-step instructions that solve a problem are called _________
A an algorithm
B a list
C a plan
D a sequential structure

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

8. When you pass a variable __________, C Language passes only the contents of the variable to the receiving function
A by reference
B by value
C globally
D locally

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

9. What does C Language append to the end of a string literal constant?
A a space
B a number sign (#)
C an asterisk (*)
D a null character

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

10. An array name is a __________
A subscript
B formal parameter
C memory address
D prototype

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

11. To enter a comment in a C Language program, you begin the comment with ________
A **
B &&
C \\
D //

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

12. Which of the following is invalid string constant?
A '7.15 pm'
B "i like e"
C "7.3el2"
D "1234el2"

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

13. You mark the beginning of a function's block of code with the _________
A /
B *
C {
D }

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

14. Sending a copy of data to a program module is called __________
A passing a value
B making a reference
C recursion
D setting a condition

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

15. Only passing by _________ and passing by _________ allow the function to modify the argument in the calling program.
A reference, pointer
B array, location
C array, pointer
D None of the above

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

16. Which of the following assigns the number 5 to the area variable?
A area 1 = 5
B area = 5
C area == 5
D area --> 5

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

17. A fundamental type such as int or double is a __________
A programmer-defined type
B complex type
C nonscalar type
D scalar type

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

18. Which of the following is the inequality operator?
A !=
B =
C ==
D -->

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

19. One of the relational operators in the C language is
A !=
B &&
C !
D #

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

20. One of the logical operators in the C language is represented by the symbol
A AND
B &&
C >=
D <=

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

21. In C, the address operator is the following symbol _________
A >>
B &
C *
D !

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

22. Which of the following statements should be used to obtain a remainder after dividing 3.14 by 2.1 ?
A rem = 3.14 % 2.1;
B rem = modf(3.14, 2.1);
C rem = fmod(3.14, 2.1);
D Remainder cannot be obtain in floating point division.

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

23. What are the types of linkages in C Language?
A Internal and External
B External, Internal and None
C External and None
D Internal

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

24. Which of the following special symbol allowed in a variable name in C Language?
A * (asterisk)
B | (pipeline)
C - (hyphen)
D _ (underscore)

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

25. Is there any difference between following declarations?
extern int fun();
int fun();
A Both are identical
B No difference, except extern int fun(); is probably in another file
C int fun(); is overrided with extern int fun();
D None of these

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

26. How would you round off a value from 1.66 to 2.0 in C Language?
A ceil(1.66)
B floor(1.66)
C roundup(1.66)
D roundto(1.66)

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

27. By default a real number is treated in C Language as a
A float
B double
C long double
D far double

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

28. Is the following statement a declaration or definition in reference to C Language?
extern int i;
A Declaration
B Definition
C Function
D Error

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

29. Identify which of the following are declarations in C Language.
1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);
A 1
B 2
C 1 and 3
D 3

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

30. In the following C language program where is the variable a getting defined and where it is getting declared?
#include
int main()
{
extern int a;
printf("%d\\n", a);
return 0;
}
int a=20;
A extern int a; is declaration, int a = 20; is the definition
B int a = 20; is declaration, extern int a; is the definition
C int a = 20; is definition, a is not defined
D a is declared, a is not defined

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

31. When we mention the prototype of a function in C Language?
A Defining
B Declaring
C Prototyping
D Calling

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

32. Combine the following two statements into one?
char *p;
p = (char*) malloc(100);
A char p = *malloc(100);
B char *p = (char) malloc(100);
C char *p = (char*)malloc(100);
D char *p = (char *)(malloc*)(100);

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

33. In which header file is the NULL macro defined?
A stdio.h
B stddef.h
C stdio.h and stddef.h
D math.h

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

34. How many bytes are occupied by near, far and huge pointers (Dos)?
A near=2 far=4 huge=4
B near=4 far=8 huge=8
C near=2 far=4 huge=8
D near=4 far=4 huge=8

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

35. If a variable is a pointer to a structure, then which of the following operator is used to access data members of the structure through the pointer variable?
A .
B &
C *
D ->

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

36. What would be the equivalent pointer expression for referring the array element a[i][j][k][l]
A ((((a+i)+j)+k)+l)
B *(*(*(*(a+i)+j)+k)+l)
C (((a+i)+j)+k+l)
D ((a+i)+j+k+l)

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

37. A pointer is
A A keyword used to create variables
B A variable that stores address of an instruction
C A variable that stores address of other variable
D All of the above

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

38. The operator used to get value at address stored in a pointer variable is
A *
B &
C &&
D ||

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.

39. Which bitwise operator is suitable for turning off a particular bit in a number?
A && operator
B & operator
C || operator
D ! operator

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

40. Which bitwise operator is suitable for turning on a particular bit in a number?
A && operator
B & operator
C || operator
D | operator

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

41. Which bitwise operator is suitable for checking whether a particular bit is on or off?
A && operator
B & operator
C || operator
D ! operator

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

42. Which header file should be included to use functions like malloc() and calloc()?
A memory.h
B stdlib.h
C string.h
D dos.h

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

43. What function should be used to free the memory allocated by calloc() ?
A dealloc();
B malloc();
C free();
D memalloc();

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

44. Specify the 2 library functions to dynamically allocate memory?
A malloc() and memalloc()
B alloc() and memalloc()
C malloc() and calloc()
D memalloc() and faralloc()

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

45. Input/output function prototypes and macros are defined in which header file?
A conio.h
B stdlib.h
C stdio.h
D dos.h

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

46. Which standard library function will you use to find the last occurrence of a character in a string in C?
A strnchar()
B strchar()
C strrchar()
D strrchr()

Free MCQs www.sharemcq.com     Answer: Option D
Explanation:
Available Soon.

47. What is stderr ?
A standard error
B standard error types
C standard error streams
D standard error definitions

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

48. What will the function randomize() do in Turbo C under DOS?
A returns a random number.
B returns a random number generator in the specified range.
C returns a random number generator with a random value based on time.
D return a random number with a given seed value.

Free MCQs www.sharemcq.com     Answer: Option C
Explanation:
Available Soon.

49. What will function gcvt() do?
A Convert vector to integer value
B Convert floating-point number to a string
C Convert 2D array in to 1D array.
D Covert multi Dimensional array to 1D array

Free MCQs www.sharemcq.com     Answer: Option B
Explanation:
Available Soon.

50. Which of the following is not logical operator?
A &
B &&
C ||
D !

Free MCQs www.sharemcq.com     Answer: Option A
Explanation:
Available Soon.


No comments:

Post a Comment

Your Feedback is hearty Requested to make the MCQs Collection better.

Popular Posts