C Programming QP
C Programming QP
C Programming QP
#include <stdio.h>
int main()
float q = ‘a’;
printf(“%f”, q);
return 0;
b. a
c. 97.000000
d. a.0000000
Answer: (c) 97.000000
a. =
b. ||
c. ==
d. !=
Answer: (a) =
#include<stdio.h>
int main()
int p = 1, q = 2, r = 3, s = 4, x;
e = r + s = q * p;
a. Syntax error
b. 5, 2
c. 7, 2
d. 7, 4
a. if ((char) x){}
b. if (x){}
c. if (func1 (x)){}
d. if (if (x == 1)){}
Answer: (d) if (if (x == 1)){}
a. while
b. for
c. if-else
d. do-while
Answer: (c) if-else
#include <stdio.h>
int main()
int a = 0, b = 0;
l1: while (a < 2)
a++;
while (b < 3)
printf(“find\n”);
goto l1;
b. Infinite error
c. find loop
d. Compile time loop
a. External
b. Internal
Answer: (a) External
8. Out of the following operations, which one is not possible in the case of a register variable?
a. Inclusion directive
c. Preprocessor directive
12. Out of the following function definition, which one will run correctly?
a.
return (x + y);
b.
int sum(int x, int y)
{return (x + y);}
c.
int sum(x, y)
return (x + y);
Answer: (b)
{return (x + y);}
int (*p)[5];
a. A ragged array
#include <stdio.h>
struct employee
int id;
char rank[5];
void main()
{
struct employee e;
s.no = 30;
printf(“howdy”);
a. hello
b. Compile-time error
c. 5, 30
d. Varies
a. Comparing the node’s address with the address of all the other nodes
b. Travelling the list. In case we encounter the NULL, then no loop exists
c. Comparing the stored values of a node with the values present in all the other nodes
d. None of the above
Answer: (a) Comparing the node’s address with the address of all the other nodes
a. This definition will only allocate 10 pointers but will not initialize them
c. The definition will only allocate 10 pointers but will not initialize them. Also, the initialization has to be
explicitly performed
d. Error
Answer: (c) The definition will only allocate 10 pointers but will not initialize them. Also, the initialization
has to be explicitly performed
a. More than a single space shouldn’t be given when we are using typedef
b. *string p = ‘A’;
c. string p = “Hello”;
d. *string *p = “Hello”;
18. We can determine the size of a union with the help of the size of __________.
19. How much percentage of memory will be saved if we use bit-fields for the given C structure as
compared to when we don’t use bit-fields for this very structure? (Assume the size of int to be 4).
struct temp
{
int m : 1;
int n : 2;
int o : 4;
int p : 4;
}s;
a. 33.3%
b. 75%
c. 25%
d. 50%
Answer: (b) 75%
20. Out of the following snippet, which one will generate random numbers effectively?
a. rand(time(NULL));
b. rand(10);
c. rand();
Answer: (c) rand();
a. x % y
b. modulus(x, y);
c. fmod(x, y);
d. mod(x, y);
22. __________ tells a compiler that the data would be defined somewhere and it would be connected
to the linker.
a) variable
b) yvals
c) errno
d) extern
Answer: (d) extern
a) stdlib.h
b) assert.h
c) stdio.h
d) stdarg.h
Answer: (a) stdlib.h
25. _____________ is a condition in which the memory is dynamically reserved but isn’t accessible to
any program.
a) Pointer Leak
b) Frozen Memory
c) Dangling Pointer
d) Memory Leak
Keep learning and stay tuned to get the latest updates on the GATE Exam along with Eligibility
Criteria, GATE Syllabus for CSE (Computer Science Engineering), GATE CSE Notes, GATE CSE Question
Paper, and more.
GATE Related LinksTernary Operator In CDifference Between List And TupleStack And Queue
DifferenceIntroduction To C ProgrammingDifference Between Break And ContinueHow Is An Encoder
Different From A DecoderDifference Between Delete Drop And TruncateWhat Is The Difference Between
C And C++Put And Post DifferenceDifference Between Static And Dynamic
Grade/Exam Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 Class 7 Class 8 Class 9 Class 10 Class 11 Class
12 IAS CAT Bank Exam GATE
Submit
Leave a Comment
Your Mobile number and Email id will not be published. Required fields are marked *
Send OTP
Post Comment
FOLLOW US