Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Most answered questions in Programming in C
0
votes
4
answers
81
solve it
int main() { int a; char *x; x = (char *) &a; a = 512; x[0] = 1; x[1] = 2; printf("%d\n",a); return 0; } output? A. M/C dependent B. 513 C. 258 D. compiler error
int main() { int a; char *x; x = (char *) &a; a = 512; x[0] = 1; x = 2; printf("%d\n",a); return 0; }output?A. M/C dependentB. 513C. 258D. compiler error
Vivek sharma
1.4k
views
Vivek sharma
asked
Aug 13, 2015
Programming in C
programming-in-c
non-gate
+
–
0
votes
4
answers
82
C-Programming
Find output #include<stdio.h> void main() { int i=0; for(; i++ ; printf("%d",i)); printf("%d",i); } Plz explain ?
Find output #include<stdio.h void main() { int i=0; for(; i++ ; printf("%d",i)); printf("%d",i); }Plz explain ?
komal07
1.2k
views
komal07
asked
Jul 7, 2015
1
votes
4
answers
83
How to do this program?
int main() { int i = 255; char *p; p = &i; printf("%d", *p); return 0; }
int main() { int i = 255; char *p; p = &i; printf("%d", *p); return 0; }
Jonathan Decosta
628
views
Jonathan Decosta
asked
Jul 6, 2015
Programming in C
programming-in-c
programming
non-gate
+
–
41
votes
4
answers
84
GATE CSE 2015 Set 3 | Question: 54
Consider the following C program: #include<stdio.h> int f1(void); int f2(void); int f3(void); int x=10; int main() { int x=1; x += f1() + f2 () + f3() + f2(); printf("%d", x); return 0; } int f1() { int x = 25; x++; return x;} int f2() { static int x = 50; x++; return x;} int f3() { x *= 10; return x;} The output of the program is ______.
Consider the following C program:#include<stdio.h int f1(void); int f2(void); int f3(void); int x=10; int main() { int x=1; x += f1() + f2 () + f3() + f2(); printf("%d", ...
go_editor
12.0k
views
go_editor
asked
Feb 16, 2015
Programming in C
gatecse-2015-set3
programming
programming-in-c
normal
numerical-answers
+
–
41
votes
4
answers
85
GATE CSE 2015 Set 2 | Question: 15
Consider the following function written in the C programming langauge : void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } } The output of the above function on input "$ABCD \ EFGH$" is $ABCD \ EFGH$ $ABCD$ $HGFE \ DCBA$ $DCBA$
Consider the following function written in the C programming langauge :void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } }The output of the above func...
go_editor
14.6k
views
go_editor
asked
Feb 12, 2015
Programming in C
gatecse-2015-set2
programming
programming-in-c
normal
recursion
+
–
0
votes
4
answers
86
what is the output of foo(10)?
int foo(unsigned int n) { int c,x=0; while(n!=0) { if(n&01) x++; n>>=1; } return c; }
int foo(unsigned int n) { int c,x=0; while(n!=0) { if(n&01) x++; n>>=1; } return c; }
Tariq Husain Khan
1.4k
views
Tariq Husain Khan
asked
Dec 10, 2014
Programming in C
programming
recursion
+
–
1
votes
4
answers
87
Consider the following program
int i = 1; int main() { int a[]= { 0,1, 2} ; f(a[i], i); printf("%d", a[i]); } void f(int x, int y) { y++; x=5*i; } In above function f() uses " call by name" technique, what is the output printed? a) 2 b) 10 c) 5 d) 1
int i = 1; int main() { int a[]= { 0,1, 2} ; f(a[i], i); printf("%d", a[i]); } void f(int x, int y) { y++; x=5*i; }In above function f() uses " call by name" technique, w...
Isha Karn
994
views
Isha Karn
asked
Dec 9, 2014
Programming in C
programming
parameter-passing
+
–
37
votes
4
answers
88
GATE IT 2005 | Question: 58
Let $a$ be an array containing $n$ integers in increasing order. The following algorithm determines whether there are two distinct numbers in the array whose difference is a specified number $S > 0$. i = 0; j = 1; while (j < n ){ if (E) j++; else if (a[j] - a[i] == S) break; else i+ ... $a[j] - a[i] < S$ $a[i] - a[j] < S$ $a[i] - a[j] > S$
Let $a$ be an array containing $n$ integers in increasing order. The following algorithm determines whether there are two distinct numbers in the array whose difference i...
Ishrat Jahan
9.9k
views
Ishrat Jahan
asked
Nov 3, 2014
Programming in C
gateit-2005
programming
normal
programming-in-c
+
–
23
votes
4
answers
89
GATE IT 2008 | Question: 50
Consider the C program below. What does it print? # include <stdio.h> # define swapl (a, b) tmp = a; a = b; b = tmp void swap2 ( int a, int b) { int tmp; tmp = a; a = b; b = tmp; } void swap3 (int*a, int*b) { int tmp; tmp = *a; *a = *b; *b ... (num1 > = num2) {swap3 (&num1, &num2);} printf ("%d, %d", num1, num2); } $5, 5$ $5, 4$ $4, 5$ $4, 4$
Consider the C program below. What does it print?# include <stdio.h # define swapl (a, b) tmp = a; a = b; b = tmp void swap2 ( int a, int b) { int tmp; tmp = a; a = b; b ...
Ishrat Jahan
10.6k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
easy
parameter-passing
+
–
30
votes
4
answers
90
GATE IT 2008 | Question: 49
What is the output printed by the following C code? # include <stdio.h> int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j--]); printf ("%s\n", a); } dlrow Null string dlrld worow
What is the output printed by the following C code?# include <stdio.h int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j ]); printf ("...
Ishrat Jahan
9.7k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
45
votes
4
answers
91
GATE CSE 2012 | Question: 48
Consider the following C code segment. int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf( \n %d %d , a, b); } void prtFun(void) { static int a = 2; /* Line 2 */ int b = 1; a += + ... $\begin{array}{lll} 3 & & 1 & \\ 5 & & 2 & \\ 5 & & 2 & \end{array}$
Consider the following C code segment.int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf(“ \n %d %d ”, a, ...
gatecse
14.0k
views
gatecse
asked
Sep 29, 2014
Programming in C
gatecse-2012
programming
programming-in-c
normal
+
–
41
votes
4
answers
92
GATE CSE 2014 Set 2 | Question: 42
Consider the C function given below. int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; } Which one of the following is TRUE? The function returns $0$ for all ... . The function returns $0$ when $j = 50$. The function will exhaust the runtime stack or run into an infinite loop when $j = 50$.
Consider the C function given below.int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else return 0; }Which one of the fol...
go_editor
9.0k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
programming-in-c
+
–
59
votes
4
answers
93
GATE CSE 2014 Set 2 | Question: 40
Consider the following function. double f(double x){ if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); } Give a value $q$ (to $2$ decimals) such that $f(q)$ will return $q$:_____.
Consider the following function.double f(double x){ if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); }Give a value $q$ (to $2$ decimals) such that $f(q)$ wi...
go_editor
19.5k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
recursion
numerical-answers
normal
+
–
131
votes
4
answers
94
GATE CSE 2014 Set 2 | Question: 11
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set $p$ correctly? $p = n * (n-1) * (n-2) / 6;$ $p = n * (n-1) / 2 * (n-2) / 3;$ $p = n * (n-1) / 3 * (n-2) / 2;$ $p = n * (n-1) * (n-2) / 6.0;$
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set...
go_editor
15.8k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
programming-in-c
normal
+
–
78
votes
4
answers
95
GATE CSE 2006 | Question: 57
Consider this C code to swap two integers and these five statements: the code 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 ... procedure correctly for some but not all valid input pointers S5: may add or subtract integers and pointers S1 S2 and S3 S2 and S4 S2 and S5
Consider this C code to swap two integers and these five statements: the codevoid swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; }S1...
Rucha Shelke
21.1k
views
Rucha Shelke
asked
Sep 26, 2014
Programming in C
gatecse-2006
programming
programming-in-c
normal
pointers
+
–
39
votes
4
answers
96
GATE CSE 2003 | Question: 24
Which of the following statements is FALSE? In statically typed languages, each variable in a program has a fixed type In un-typed languages, values do not have any types In dynamically typed languages, variables have no types In all statically typed languages, each variable in a program is associated with values of only a single type during the execution of the program
Which of the following statements is FALSE?In statically typed languages, each variable in a program has a fixed typeIn un-typed languages, values do not have any typesIn...
Kathleen
9.2k
views
Kathleen
asked
Sep 16, 2014
Programming in C
gatecse-2003
programming
normal
type-checking
+
–
72
votes
4
answers
97
GATE CSE 2003 | Question: 2
Assume the following C variable declaration: int *A[10], B[10][10]; Of the following expressions: $A[2]$ $A[2][3]$ $B[1]$ $B[2][3]$ which will not give compile-time errors if used as left hand sides of assignment statements in a C program? I, II, and IV only II, III, and IV only II and IV only IV only
Assume the following C variable declaration:int *A[10], B[10][10];Of the following expressions:$A $$A [3]$$B $$B [3]$which will not give compile-time errors if used as le...
Kathleen
30.3k
views
Kathleen
asked
Sep 16, 2014
Programming in C
gatecse-2003
programming
programming-in-c
easy
pointers
+
–
39
votes
4
answers
98
GATE CSE 2002 | Question: 2.8
Consider the following declaration of a two-dimensional array in C: char $a[100][100]$; Assuming that the main memory is byte-addressable and that the array is stored starting from memory address $0$, the address of $a [40][50]$ is: $4040$ $4050$ $5040$ $5050$
Consider the following declaration of a two-dimensional array in C:char $a[100][100]$;Assuming that the main memory is byte-addressable and that the array is stored start...
Kathleen
28.2k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming-in-c
programming
easy
+
–
27
votes
4
answers
99
GATE CSE 2001 | Question: 2.17 | UGCNET-AUG2016-III: 21
What is printed by the print statements in the program $P1$ 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 } $\text{10, 3}$ $\text{31, 3}$ $\text{27, 7}$ None of the above
What is printed by the print statements in the program $P1$ assuming call by reference parameter passing?Program P1() { x = 10; y = 3; func1(y,x,x); print x; print y; } f...
Kathleen
12.5k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2001
programming-in-c
parameter-passing
normal
ugcnetcse-aug2016-paper3
+
–
51
votes
4
answers
100
GATE CSE 2000 | Question: 1.17, ISRO2015-79
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 $2$ bytes, $4$ bytes and $8$ bytes, respectively. The memory requirement for variable $t$, ignoring alignment consideration, is: $22$ bytes $14$ bytes $18$ bytes $10$ bytes
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 $2$ bytes, $4$...
Kathleen
20.9k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
isro2015
union
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
...
206
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register