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
The results returned by function under value-result and reference parameter passing conventions
In the C language:
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?
Consider the following three C functions: int *g(void) { int x = 10; return (&x); } int *g(void) { int *px; *px = 10; return px; } 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?
What is printed by the print statements in the program 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 }
The value of 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:
Aliasing in the context of programming languages refers to
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 bytes, bytes and bytes, respectively. The memory requirement for variable , ignoring alignment consideration, is:
The most appropriate matching for the following pairs …
The following C declarations: struct node { int i: float j; }; struct node *s[10]; define s to be:
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:
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., …
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
An unrestricted use of the "" statement is harmful because
In which of the following cases is it possible to obtain different results for call-by-reference and call-by-name parameter passing methods?
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s):
