adplus-dvertising

Welcome to the Programming in C MCQs Page

Dive deep into the fascinating world of Programming in C with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Programming in C, a crucial aspect of UGC CBSE NET Exam. In this section, you will encounter a diverse range of MCQs that cover various aspects of Programming in C, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within UGC CBSE NET Exam.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Programming in C. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of UGC CBSE NET Exam.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Programming in C. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Programming in C MCQs | Page 15 of 16

Q141.
The output generated by the following C program does not include the value:
#include<stdio.h>
main()
{
int n=3;
while(n>1)
{
if((n%2)!=1)
n=n/2;
else
n=3*n+1;
printf(“%d”,n);
}
}

a.

5

b.

6

c.

8

d.

16

Discuss
Answer: (b).6
Q142.
Consider the following pseudo-code fragment, where m is a non-negative integer that has been initialized.

Which of the following is a loop invariant for the while statement?
(Note: a loop invariant for a while statement is an assertion that is true each time the guard is evaluated during the execution of the while statement).
p = 0
k = 0
while (k<m)
                 p = p + 2k
                 k = k + 1
end while
Discuss
Answer: (c).p = 2^k − 1 and 0≤k≤m
Q143.
Consider the following two C++ programs P1 and P2 and two statements S1 and S2 about these programs:

S1: P1 prints out 3.
S2: P2 prints out 4:2

What can you say about the statements S1 and S2?
Discuss
Answer: (a).Only S1 is true
Q144.
What is the output of the following ‘C’ program? (Assuming little - endian representation of multi-byte data in which Least Significant Byte (LSB) is stored at the lowest memory address.)
#include <stdio.h>
#include <stdlib.h>
/* Assume short int occupies two bytes of storage */
int main ( )
{
union saving
{
short int one;
char two[2];
};
union saving m;
m.two [0] = 5;
m.two [1] = 2;
printf(’’%d, %d, %d\n”, m.two [0], m.two [1], m.one);
}/* end of main */
Discuss
Answer: (d).5, 2, 517
Q145.
Given below are three implementations of the swap( ) function in C++ .

Which of these would actually swap the contents of the two integer variables p and q?
Discuss
Answer: (b).(b) only
Q146.
Which of the following statements is/are True?

P: C programming language has a weak type system with static types.
Q: Java programming language has a strong type system with static types.
Discuss
Answer: (c).Both P and Q
Q147.
'ptrdata' is a pointer to a data type. The expression *ptrdata++ is evaluated as (in C++):
Discuss
Answer: (a).*(ptrdata++)
Q148.
The associativity of which of the following operators is Left to Right, in C++?
Discuss
Answer: (c).Array element access
Q149.
A member function can always access the data in ................ , (in C++).
Discuss
Answer: (a).the class of which it is member
Discuss
Answer: (b).Virtual function can be static.

Suggested Topics

Are you eager to expand your knowledge beyond Programming in C? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!