0% found this document useful (0 votes)
35 views

Programming For Problem Solving Set 3

This document contains 75 multiple choice questions about programming in C. The questions cover topics such as loops, arrays, data types, operators, functions, pointers, preprocessor directives, storage classes and more. Each question is followed by 4 possible answers with one correct answer indicated. The questions test fundamental C programming concepts as well as knowledge of the C standard library and compiler functionality.

Uploaded by

Md. Al Mamun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Programming For Problem Solving Set 3

This document contains 75 multiple choice questions about programming in C. The questions cover topics such as loops, arrays, data types, operators, functions, pointers, preprocessor directives, storage classes and more. Each question is followed by 4 possible answers with one correct answer indicated. The questions test fundamental C programming concepts as well as knowledge of the C standard library and compiler functionality.

Uploaded by

Md. Al Mamun
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Programming for Problem Solving MCQs

[set-3]

51. What is output of below program?


int main()
{
int i,j;
for(i = 0,j=0;i<5;i++)
{
printf("%d%d--",i,j);
}
return 0;
o m
}
. c
A. 0--01--12--23--34--
te
B. 00--10--20--30--40-- a
C. Compilation Error
q M
D. 00--01--02--03--04--
c
Answer: B
M
52. What is output of below program?
int main()
{
int i;
for(i=0; i<5; ++i++)
{
printf("Hello");
}
return 0;
}
A. Hello is printed 5 times
B. Compilation Error
C. Hello is printed 2 times
D. Hello is printed 3 times
Answer: B

53. What is output of below program?


int main()
{
for(; ;);
for(; ;);
printf("Hello");
return 0;
}
A. Compilation Error
B. Runtime Error
C. Nothing is printed
D. Hello is printed infinite times
Answer: C

54. What is the output of below program?


int main()
{
for(; ;)
for(; ;)
printf("Hello..");
return 0;
}
A. Compilation Error
B. Runtime Error
C. Hello is printed one time
D. Hello is printed infinite times
Answer: D

55. How many loops are there in C


A. 1
B. 2
C. 3
D. 4
Answer: C

View all MCQ's at McqMate.com


56. What is the following is invalid header file in C?
A. math.h
B. mathio.h
C. string.h
D. ctype.h
Answer: B

57. What is storage class for variable A in below code?


int main()
{
int A;
A = 10;
printf("%d", A);
return 0;
}
A. extern
B. auto
C. register
D. static
Answer: B

58. #include "stdio.h"


int main()
{
int a@ = 10;
printf("%d", a@);
return 0;
}
A. 10
B. 10@
C. @
D. [Error] stray '@' in program
Answer: D

59. #include "stdio.h"


int main()
{

View all MCQ's at McqMate.com


int a = 10;
printf("%d", a);
int a = 20;
printf("%d",a);
return 0;
}
A. 1020
B. Error: Redeclartion of a
C. 2020
D. 1010
Answer: B

60. #include "stdio.h"


int a = 20;
int main()
{
int a = 10;
printf("%d", ::a);
return 0;
}
A. 10
B. 20
C. ::20
D. ::10
Answer: B

61. #include "stdio.h"


int main()
{
int a = 10, b = 20;
if(a=b)
{
printf("Easy");
}
else
{
printf("Hard");

View all MCQ's at McqMate.com


}
return 0;
}
A. Easy
B. Hard
C. EasyHard
D. Error in program
Answer: A

62. Which gcc flag is used to enable all Compiler warnings?


A. gcc -W
B. gcc -w
C. gcc -Wall
D. gcc -wall
Answer: C

63. Which gcc flag is used to generate maximum debug information?


A. gcc -g0
B. gcc –g1
C. gcc -g
D. gcc –g3
Answer: D

64. Which macro is used to insert assembly code in C program (VC++ compiler)?
A. __asm__
B. _asm_
C. __asm
D. asm
Answer: C

65. Which macro is used to insert assembly code in C program (GCC compiler)?
A. __asm__
B. _asm_
C. __asm
D. asm
Answer: A

View all MCQ's at McqMate.com


66. Will compiler produce any compilation error if same header file is included two
times?
A. YES
B. NO
C. Option.
D. Option.
Answer: B

67. What should be the output of below program?


#define # @
@include "stdio.h"
int main()
{
printf("C.com");
return 0;
}
A. C.com
B. Nothing
C. Compilation Error
D. Depends on Complier
Answer: C

68. Which one of the following is invalid macro in C programming?


A. #pragma
B. #error
C. #ifndef
D. #elseif
Answer: D

69. What is the extension of output file produced by Preprocessor?


A. .h
B. .exe
C. .i
D. .asm
Answer: C

70. Set of consecutive memory locations is called as ________.

View all MCQ's at McqMate.com


A. Function
B. Array
C. Loop
D. Pointer
Answer: B

71. Array can be considered as set of elements stored in consecutive memory


locations but having __________.
A. Same Data Type
B. Same Scope
C. None of these
D. Different Data Type
Answer: A

72. In Array, There is one to one correspondence between set of ________ and set
of values.
A. Indices
B. Variables
C. Constants
D. Memory Locations
Answer: A

73. Smallest element of an array is called as _______.


A. Middle Bound
B. Range
C. Upper Bound
D. Lower Bound
Answer: D

74. If we have declared an array described below –


int arr[6];
then which of the following array element is considered as last array element ?
A. arr[6]
B. arr[4]
C. arr[0]
D. arr[5]
Answer: D

View all MCQ's at McqMate.com


75. Array which is having ____ dimensions is called as 2-D array.
A. 3
B. 2
C. 5
D. 4
Answer: B

View all MCQ's at McqMate.com

You might also like