Problem solving C-Language MCQs-03

Posted by

The "Answers" given with the Question is "not verified". To view Verified answers click on the button below.

C Language MCQs (100% free pdf download)

95. If ptr is a pointer to int, having value ptr=100. After ptr++, what is the value of ptr?
(a)100
(b)101
(c)102
(d)103

96. Address stored in the pointer variable is of type ________
(a) Integer
(b) Floating
(c) Hexadecimal
(d) Character

97. ………… is the method used by card sorter.
a) Radix sort
b) Insertion
c) Heap
d) Quick

98. Partition and exchange sort is ……..
a) quick sort
b) tree sort
c) heap sort
d) bubble sort

99. Which of the following is a disadvantage of linear search?
a) Requires more space
b) Greater time complexities compared to other searching algorithms
c) Not easy to understand
d) All of the mentioned

100. Consider the array A[]= {5,4,9,1,3} apply the insertion sort to sort the array Consider the cost associated with each sort is 25 rupees, what is the total cost of the insertion sort for sorting the entire array?
a) 25
b) 50
c) 75
d) 100

101. The first expression in a for… loop is
a) Step value of loop
b) Value of the counter variable
c) Condition statement
d) None of the above

102. Continue statement used for
a) To continue to the next line of code
b) To stop the current iteration and begin the next iteration from the beginning
c) To handle run time error
d) None of above

103. Which of the following loop is executed at least once?
a) do-while
b) for
c) if
d) while

104. Which among the following is a unconditional control structure.
a) goto
b) for
c) do-while
d) if-else

105. Which of the following is ternary operator?
(a) ??
(b) ?:
(c) 😕
(d) ::

106. ASCII value of ‘A’ is .
(a) 55
(b) 75
(c) 65
(d) 85

107. Which are not looping structures?
(a) Forloop
(b) Do…whileloop
(c) Whileloop
(d) if…else

108. How many times the following code prints the string “hello”
for(i=1;i<=50;i++);
{
printf(“Hello”);
}
(a)1
(b)Zero
(c)50
(d) None ofthem

109. Which of following is not a valid assignment expression?
(a) Y =22;
(b) s = x ;
(c) y % = 6;
(d) z=5=3;

110. How many times the following loop will be executed.
main( )
{
int i = 32766;
while(i<=32767)
{
printf(“%d\n”,i);
i = i +1;
}
}
(a) 2 times
(b) 1 times
(c) Infinite time
(d) loop will not be executed
www.aktutor.in

111. What is the output of the following code:
void main()
{
int i;
for(i=1;i<=10;i++);
{
printf(“%d\n”,i);
}
}
(a) 10
(b) 1 to 10
(c) 11
(d) None of the above

112. What is the output of the following code:
void main()
{
int i;
for(i=65;i<70;i++)
{
printf(“%c,”,i);
}
}
(a) 65,66,67,68,69,70
(b) a,b,c,d,e,
(c) A,B,C,D,E
(d) A,B,C,D,E

113. What is the output of the following code:
void main()
{
int i=5;
switch(i)
{
case 3: printf(“three”);
case 4: printf(“four”);
case 5: printf(“five”);
case 6: printf(“six”);break;
case 7: printf(“seven”);
default: printf(“default”);
}
}
(a)five
(b)fivesixsevendefault
(c) fivesix
(d) None of the above

114. ASCII value of ‘a’ is
(a) 97
(b) 65
(c) 47
(d) None of the above

115. Break statement is used for
(a) Quit a program
(b) Both a and b
(c) Quit the current iteration
(d) None of the above

116. Which one is the correct syntax of for loop?
(a) for(initialization, condition, increment/decrement)
(b) for(initialization; condition; increment/decrement)
(c) for(condition, condition, increment/decrement)
(d) for(condition; initilization; increment/decrement)

117. What is the output of following C code?
int k;
for(k=1;k>=10;k++);
printf(“Hello”);
(a) prints “Hello” 10 times
(b) prints nothing
(c) prints “Hello” infinite times
(d) prints “Hello” 1 time

118. For loop is _________.
(a)Function Controlled Loop
(b)Exit Controlled Loop
(c)Entry Controlled Loop
(d) None of these

119. What will be the output of following code.
{
int x = 10, y=15;
x = x++;
y = ++y;
printf(“%d, %d \n” , x, y);
}
(a) 10, 15
(b) 10, 16
(c) 11, 16
(d) 11, 15

120. Which of the following is used as a string termination character?
(a) 0
(b) \0
(c) /0
(d) None of these

121. Which of the following function is more appropriate for reading in a multi word string?
(a) printf();
(b) scanf();
(c) gets();
(d) puts();

122. Array index start at
(a) 1
(b) User Defined
(c) 0
(d) None of above

123. Every string is terminated by NULL character. How it is represented?
(a) ‘\0’
(b) NULL
(c) both a and b
(d) None of above

124. The format string to accept a string is
(a)%c
(b)%d
(c)%f
(d)%s

125. Which header file is necessary for strlen() function?
(a)conio.h
(b)strings.h
(c)string.h
(d)stdio.h

126. Recursion is a process in which a function calls
(a) itself
(b) another function
(c) main() function
(d) none of the above

127. When function calls itself, it is known as .
(a) Recursion
(b) exit control loop
(c) Nested loop
(d) user defined function

128. A pointer value refers to
a) A float value
b) An integer constant
c) Any valid address in memory
d) None

129. If ptr is a pointer to int, having value ptr=100. After ptr++, what is the value of ptr?
(a) 100
(b) 102
(c) 101
(d) 103

130. What is the output of the following C code?
int main()
{
int *ptr,a=10;
ptr = &a;
*ptr +=1;
printf(“%d%d\n”,*ptr,a);
}
(a) 10,10
(b) 10,11
(c) 11,10
(d) 11,11

131. Address stored in the pointer variable is of type _________
(a) Character
(b) Integer
(c) Floating
(d) Array

132. Structure can contain elements of the different data type
(a) true
(b) false

133. Which of the following operator is used to select a member of a structure variable
(a) .(dot)
(b) ,(comma)
(c) : (colon)
(d) ;(semicolon)

134. Default value of global variable is
(a) 0
(b) Garbage value
(c) 1
(d) Depend on datatype

135. Default value of local variable is
(a) Garbage value
(b) 0
(c) 1
(d) Depend on data type

136. MACRO is used to _______
(a) Save memory
(b) Both a & c
(c) fast execution
(d) none of above

137. Which of the following operator is used to select a member of a structure variable
(a) .(dot)
(b) ,(comma)
(c) : (colon)
(d) ;(semicolon)

138. What is the output of the following code:
void main()
{
enum day { Mon,Tue,Wed,Thu,Fri,Sat,Sun};
printf(“%d”,Fri);
getch();
}
(a) 5
(b) Error
(c) 4
(d) Fri

139. Difference between calloc() and malloc()
a) calloc() takes a single argument while malloc() needs two arguments
b) malloc() takes a single argument while calloc() needs two arguments
c) malloc() initializes the allocated memory to ZERO
d) calloc() initializes the allocated memory to NULL

140. Which function reallocates memory?
(a) realloc
(b) calloc
(c) malloc
(d) None of these

141. Which function should be used to release allocated memory which is not needed?
(a) dealloc
(b) free()
(c) release()
(d) unalloc()

142. File manipulation functions in C are available in which header file?
(a) streams.h
(b) stdio.h
(c) stdlib.h
(d) files.h

143. When fopen() fails to open a file it returns
(a) NULL
(b) 1
(c) -1
(d) None of above

144. Which function is used to put the file pointer at the desired location in the file?
(a) fseek()
(b) rewind()
(c) ftell()
(d) fptr()