Recent questions in Programming in C

#41
303
views
1 answers
4 votes
Consider the following pseudocode procedure.Which of the following best describes procedure mystery?It returns a list of numbers from 1 to $n$.It prints every third number from 1 ... $n$.
#42
384
views
1 answers
1 votes
In what cases does an uninitialized array have values = 0 and for which cases does it have values = garbage values. How to differentiate?
#43
297
views
1 answers
1 votes
Does C support fractional Indices?float x = some fraction;Is float a[x] valid declaration?
#44
475
views
1 answers
5 votes
What will be output printed by the following program?#include<stdio.h> main() { int c=4; switch(c) { c=c-1; case 4: ... $\text{IITB IISc IITM}$\text{IITB}$\text{IITB IITM IITD}$
#45
384
views
0 answers
4 votes
What will be the output of the following program?#include <stdio.h> int main() { int a[2][2] = { {1, 2}, {3, 4} }; int (*p)[2][2]; p = &a; printf("%d", (*p)[0][1]); return 0; }$1$2$3$4$
#46
403
views
1 answers
3 votes
#include<stdio.h> #include<string.h> char upstr[50]; void putStar (int n,char str[]){ upstr[n] = str[n]; if(n == strlen(str)) return; else upstr[n+1] = '*'; putStar ... be the output of the given program?h*e*l*l*oh*e*l*l*o*h*e*l*l*hello
#47
664
views
2 answers
8 votes
#include <stdio.h> int main() { int i= 255; short int *s= (short int *)&i; printf("%d\n", *s); }What will be the output of the above program in little-endian and big- ... $65280,\; 0$0,\;0$0,\; 65280$
#48
483
views
1 answers
2 votes
Consider the following two declarations for $\textsf{arr1}$ and $\textsf{arr2}:$int arr1[2][3]; int r1[3]; int r2[3]; int * arr2[2] = {r1, ... $(\operatorname{arr}2)=32$ bytes
#49
707
views
3 answers
7 votes
What will be the output of following program ?#include <stdio.h> int thefunction(int a) { static int b = 0; b++; a = a + b; return a; } int main() { int b = 0; int i; ... 3; i++) { b = b + thefunction(i); } printf("%d\n", b); return 0; }
#50
511
views
1 answers
6 votes
What will be the output of the following program?main() { int a[2][2] = { {1,2},{3,4} }; int(*p)[2][2]; p = &a; printf("%d", (*p)[0][0]); }$1$3$4$None of these
#51
532
views
1 answers
6 votes
What will be the output of the following C program?#include<stdio.h> void main() { int i=6; for(--i; --i; i--) { printf("%d",i); } }$42$31$Infinite loopNone of these
#52
572
views
1 answers
1 votes
Consider the following C program:-#include <stdio.h> void ubswap(int **a, int **b) { int* temp = *a; *a = *b; *b = temp; } int main() { int x = 1, y = 9; int ... $x$ and $y$u$ and $v$a$ and $b$None of the above
#53
10.0k
views
4 answers
13 votes
Consider the following C program :#include<stdio.h> int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n",x); return 0; }The value printed by the program is ______________.
#54
804
views
1 answers
2 votes
void main() { char *p="cprogramming"; }I know the string literal "cprogramming" is stored in read only data segment. But where will the pointer p be stored, in stack or read-write data segment ?
#55
1.2k
views
1 answers
1 votes
Pick the best statement for the below program:#include "stdio.h" int main() { struct { int a[2], b; } arr[] = {[0].a = {1}, [1].a = {2}, [0] ... and initialized. Output would be 1 X 1 and 2 X 2 where X is some garbage random number.
#56
3.3k
views
3 answers
1 votes
void main() { unsigned char var=0; for(var=0;var<=255;var++) { printf("%d ",var); } }What is output of this code?
#57
1.6k
views
2 answers
1 votes
main() { char *p1="name"; char *p2; p2=(char*)malloc(20); memset(p2,0,20); while(*p2++=*p1++); printf("%s\n",p2); }
#58
686
views
1 answers
0 votes
explain the output#include <stdio.h>int main(){ int a=1; printf("%d %d %d",a,a++,--a); return 0; }
#59
606
views
1 answers
1 votes
what is the output of the following program ??
#60
2.2k
views
4 answers
2 votes
#include <stdio.h> int main() { unsigned char a = 5; a |= (1<<((sizeof(char)<<3)-1)); char b = a; printf("%d %d\n",b,a); printf("%u %u\n",b,a); }If the size of a char datatype is 1 Byte, then what will be the output?[Edited]