Skip to content

GATE CS Programming in C questions

Practise Programming in C questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.

Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.

16 on this page
Official PYQ2002Programming and Data StructuresProgramming in CMCQ · 1 mark
The results returned by function under value-result and reference parameter passing conventions
Official PYQ2002Programming and Data StructuresProgramming in CMCQ · 1 mark
In the C language:
Official PYQ2001Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following program Program P2 var n : int; procedure W(var x : int) begin x = x + 1; print x; end procedure D begin var n : int; n = 3; W(n); end begin \\begin P2 n=10; D; end If the language has dynamic scooping and parameters are passed by reference, what will be printed by the program?
Official PYQ2001Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following three C functions: [P1][P1] int *g(void) { int x = 10; return (&x); } [P2][P2] int *g(void) { int *px; *px = 10; return px; } [P3][P3] int *g(void) { int *px; px = (int*) malloc (sizeof(int)); *px = 10; return px; } Which of the above three functions are likely to cause problems with pointers?
Official PYQ2001Programming and Data StructuresProgramming in CMCQ · 1 mark
What is printed by the print statements in the program P1P1 assuming call by reference parameter passing? Program P1() { x = 10; y = 3; func1(y,x,x); print x; print y; } func1(x,y,z) { y = y + 4; z = x + y + z }
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
The value of jj at the end of the execution of the following C program: int incr (int i) { static int count = 0; count = count + i; return (count); } main () { int i, j; for (i = 0; i <= 4; i++) j = incr (i); } is:
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
Aliasing in the context of programming languages refers to
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following C declaration: struct { short x[5]; union { float y; long z; } u; )t; Assume that the objects of the type short, float and long occupy 22 bytes, 44 bytes and 88 bytes, respectively. The memory requirement for variable tt, ignoring alignment consideration, is:
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
The most appropriate matching for the following pairs …
Official PYQ2000Programming and Data StructuresProgramming in CMCQ · 1 mark
The following C declarations: struct node { int i: float j; }; struct node *s[10]; define s to be:
Official PYQ1999Programming and Data StructuresProgramming in CMCQ · 1 mark
Consider the following program in a language that has dynamic scooping: var x: real; procedure show: begin print(x);end; procedure small; var x: real; begin x: = 0.125; show; end; begin x:=0.25 show; small end. Then the output of the program is:
Official PYQ1999Programming and Data StructuresProgramming in CMCQ · 1 mark
Given the programming constructs assignment for loops where the loop parameter cannot be changed within the loop if-then-else forward go to arbitrary go to non-recursive procedure call recursive procedure/function call repeat loop, which constructs will you not include in a programming language such that it should be possible to program the terminates (i.e., …
Official PYQ1998Programming and Data StructuresProgramming in CMCQ · 1 mark
What is the result of the following program? program side-effect (input, output); var x, result: integer; function f (var x:integer):integer; begin x:x+1;f:=x; end begin x:=5; result:=f(x)*f(x); writeln(result); end
Official PYQ1994Programming and Data StructuresProgramming in CMCQ · 1 mark
An unrestricted use of the "gotogoto" statement is harmful because
Official PYQ1994Programming and Data StructuresProgramming in CMCQ · 1 mark
In which of the following cases is it possible to obtain different results for call-by-reference and call-by-name parameter passing methods?
Official PYQ1989Programming and Data StructuresProgramming in CMCQ · 1 mark
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s):