Showing posts with label GATE C. Show all posts
Showing posts with label GATE C. Show all posts

C Program GATE 2018 -8

Consider the following C code. Assume that unsigned long int type length is 64 bits.

unsigned long int fun(unsigned long int n){
    unsigned long int i, j = 0, sum = 0;
    for (i = n; i > 1; i = i/2) j++;
    for ( ; j > 1; j = j/2) sum++;
    return(sum);
}
Share:

C Program GATE 2018 -7

Consider the following C program:

#include<stdio.h>
 
void fun1(char *s1, char *s2){
     char *tmp;
     tmp = s1;
     s1 = s2;
     s2 = tmp;
}
Share:

C Program GATE 2019 -4

C Program : GATE 2019


Consider the following C program:

#include <stdio.h> 

int main(){

float sum = 0.0, j = 1.0, i = 2.0

while (i/j > 0.0625){

j = j + j;

sum = sum + i/j;

printf("%f\n", sum);

}

return 0;

}


The number of times the variable sum will be printed, when the above program is executed, is _________________.
Share:

C Program GATE 2019-1

C Program : GATE 2019


Consider the following C program 

#include <stdio.h>

int main(){ 

int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4;
Share: