C-GATE

Set-15 C-Programming Gate 2005

C-Programming |Gate-2005| previous year questions| Set-15

C-Programming |Gate-2005| 1. What does the following C-statement declare? int ( * f) (int * ) ; [GATE – 2005] a. A function that takes an integer pointer as argument and returns an integer.b. A function that takes an integer as argument and returns an integer pointer.c. A pointer to a function that takes an integer pointer as …

C-Programming |Gate-2005| previous year questions| Set-15 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2006| previous year questions| Set-14

C-Programming |Gate-2006| 1. Consider this C code to swap two integers and these five statements after it: void swap(int *px, int *py) {    *px = *px – *py;    *py = *px + *py;    *px = *py – *px; } S1: will generate a compilation error S2: may generate a segmentation fault at runtime depending on the arguments passed S3: …

C-Programming |Gate-2006| previous year questions| Set-14 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2007| previous year questions| Set-13

C-Programming |Gate-2007| 1. Consider the following C function, what is the output? [GATE – 2007] #include <stdio.h> int f(int n) {     static int r = 0;     if (n <= 0) return 1;     if (n > 3)     {         r = n;         return f(n-2)+2;     }     return f(n-1)+r; } int main() {     printf(“%d”, f(5)); } a. 5b. 7c. 9d. 18 Answer : d) 2. The function f is defined …

C-Programming |Gate-2007| previous year questions| Set-13 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2011| Previous Year Questions| Set-9

C-Programming |Gate-2011| 1. What does the following fragment of C-program print? [GATE – 2011] char c[] = “GATE2011”; char *p =c; printf(“%s”, p + p[3] – p[1]) ; a. GATE2011b. E2011c. 2011d. 011 Answer : c) 2. Consider the following recursive C function that takes two arguments. Unsigned int foo (unsigned int n, unsigned int r){if(n>0)return ((n%r) + …

C-Programming |Gate-2011| Previous Year Questions| Set-9 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2012| Previous Year Questions| Set-8

C-Programming |Gate-2012| 1. What will be the output of the following C program segment? [GATE – 2012] char inchar = ‘A’; switch (inchar) { case ‘A’ :     printf (“choice A n”) ; case ‘B’ :     printf (“choice B “) ; case ‘C’ : case ‘D’ : case ‘E’ : default:     printf (“No Choice”) ; } a. No choice b. Choice A c. Choice AChoice B No choice d. Program gives no …

C-Programming |Gate-2012| Previous Year Questions| Set-8 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2013| Previous Year Questions| Set-7

C-Programming |Gate-2013| 1. Consider the following function: [GATE – 2013] int unknown(int n) {     int i, j, k = 0;     for (i  = n/2; i <= n; i++)         for (j = 2; j <= n; j = j * 2)             k = k + n/2;     return k;  } a. Θ(n2)b. Θ(n2 log n)c. Θ(n3)d. Θ(n3 logn) Answer : b) 2. Consider the following …

C-Programming |Gate-2013| Previous Year Questions| Set-7 Read More »

Set-15 C-Programming Gate 2005

C-Programming |Gate-2014| Previous Year Questions| Set-6

C-Programming |Gate-2014| 1. Consider the following program in C language: #include <stdio.h> main() {     int i;     int *pi = &i;     scanf(“%d”, pi);     printf(“%dn”, i+5); } Which one of the following statements is TRUE? [GATE – 2014] a. Compilation fails.b. Execution results in a run-time error.c. On execution, the value printed is 5 more than the address of …

C-Programming |Gate-2014| Previous Year Questions| Set-6 Read More »