Hot questions in Programming in C

#1
35.8k
views
7 answers
88 votes
Consider the following C code:#include<stdio.h int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return...
#2
28.8k
views
13 answers
70 votes
Consider the following C program.#include<stdio.h #include<string.h int main() { char* c="GATECSIT2017"; char* p=c; printf("%d", (int)strlen(c+2[p]-6[p]-1)); return 0; }T...
#3
30.7k
views
4 answers
72 votes
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...
#4
28.7k
views
6 answers
110 votes
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory.int main () { unsigned int ...
#5
28.4k
views
4 answers
39 votes
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...
#6
23.1k
views
11 answers
62 votes
Consider the following C program#include<stdio.h int main() { static int a[] = {10, 20, 30, 40, 50}; static int *p[] = {a, a+3, a+4, a+1, a+2}; int ptr = p; ptr++; print...
#7
25.8k
views
7 answers
104 votes
Consider the C functions foo and bar given below:int foo(int val) { int x=0; while(val 0) { x = x + foo(val ); } return val; }int bar(int val) { int x = 0; while(val 0)...
#8
25.5k
views
9 answers
102 votes
Consider the following C program.#include<stdio.h #include<string.h void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s) - strlen(t)) c) ? strlen...
#9
16.0k
views
4 answers
132 votes
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...
#10
25.0k
views
9 answers
44 votes
Aliasing in the context of programming languages refers tomultiple variables having the same memory locationmultiple variables having the same valuemultiple variables hav...
#11
21.0k
views
5 answers
38 votes
What does the following C-statement declare?int (*f) (int * );A function that takes an integer pointer as argument and returns an integerA function that takes an integer ...
#12
20.8k
views
11 answers
47 votes
Consider the following two functions.void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("...
#13
16.7k
views
8 answers
49 votes
Consider the following C program segment.# include <stdio.h int main() { char s1[7] = "1234", *p; p = s1 + 2; *p = '0'; printf("%s", s1); }What will be printed by the pro...
#14
26.0k
views
6 answers
85 votes
Which one of the choices given below would be printed when the following program is executed?#include <stdio.h void swap (int *x, int *y) { static int *temp; temp = x; x ...
#15
16.6k
views
8 answers
51 votes
Consider the following C program:double foo (double); /* Line 1 */ int main() { double da, db; //input da db = foo(da); } double foo (double a) { return a; }The above cod...
#16
19.6k
views
4 answers
59 votes
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...
#17
16.0k
views
6 answers
5 votes
Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10. The location of A[20] [20] [30] is __________...
#18
6.5k
views
3 answers
4 votes
Consider the following $\mathrm{C}$ program:#include <stdio.h int main() { int a=6; int b = 0; while (a<10) { a = a / 12+1 ; a += b ;} printf ("%d", a); return 0 ; }Whi...
#19
18.5k
views
2 answers
1 votes
a machine took 200 sec to sort 200 names using bubble sort . in 800 sec it can approx sort how many namesa)400 b)800 c)750 d)850
#20
22.9k
views
5 answers
68 votes
The output of executing the following C program is _______________ .#include<stdio.h int total(int v) { static int count = 0; while(v) { count += v&1; v >>= 1; } return c...