code-tracing
GATE CSE & IT · Symbol Tables & Storage · 1993-2026
Study anchor
Source-book anchor pending for this concept.
Practice action
Start latest PYQPYQs in this concept
All concepts →Consider the following ANSI-C program. #include <stdio.h> int main( ) { int *ptr, a, b, c; a=5; b=11; c=20; ptr=&a; *ptr=c; ptr=&c; a=*(&b); c=*ptr-a; printf("%d",c); return(0); }...
#include <stdio.h> int foo(int S[ ], int size) { if(size == 0) return 0; if(size == 1) return 1; if(S[0]!=S[1]) return 1 + foo(S + 1, size - 1); return foo(S + 1, size - 1); } int...
int x = 126, y = 105; do{ if(x > y) x = x - y; else y = y - x; }while(x!=y); printf('%d", x); The output of the given C code segment is __________. (Answer in integer)
Consider the following C functions. int tob(int b, int* arr) { int i; for (i=0; b>0; i++) { if (b%2) arr[i] = 1; else arr[i]=0; b = b/2; } return (i); } ____________________ int pp...
Consider the following C functions. int fun1 (int n) { static int i = 0; if (n > 0) { ++i; fun1(n-1); } return (i); } ___________________ int fun2 (int n) { static int i = 0; if (n...
Consider the following C program that attempts to locate an element x in an array Y[] using binary search. The program is erroneous. 1. f(int Y[10], int x) { 2. int i, j, k; 3. i =...
Consider the following C function: 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; } What is the value of f(5)?
The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the list containing the integers...
What does the following code do? var a, b : integer; begin a:=a+b; b:=a-b; a:=a-b; end;