search
Log In

Recent questions tagged programming-in-c

3 votes
5 answers
1
Consider the following $\text{ANSI C}$ program. #include <stdio.h> int main() { int arr[4][5]; int i, j; for (i=0; i<4; i++) ​​​​​​{ for (j=0; j<5; j++) { arr[i][j] = 10 * i + j; } } printf(“%d”, *(arr[1]+9)); return 0; } What is the output of the above program? $14$ $20$ $24$ $30$
asked Feb 18 in Programming Arjun 1.8k views
0 votes
2 answers
2
Consider the following $\text{ANSI C}$ program: #include <stdio.h> #include <stdlib.h> struct Node{ int value; struct Node *next;}; int main( ) { struct Node *boxE, *head, *boxN; int index=0; boxE=head= (struct Node *) malloc(sizeof(struct Node)) ... $\textsf{return}$ which will be reported as an error by the compiler It dereferences an uninitialized pointer that may result in a run-time error
asked Feb 18 in Programming Arjun 974 views
1 vote
2 answers
3
Consider the following$\text{ ANSI C}$ program. #include <stdio.h> int main() { int i, j, count; count=0; i=0; for (j=-3; j<=3; j++) { if (( j >= 0) && (i++)) count = count + j; } count = count + ... will compile successfully and output $10$ when executed The program will compile successfully and output $8$ when executed The program will compile successfully and output $13$ when executed
asked Feb 18 in Programming Arjun 695 views
1 vote
1 answer
4
Consider the following pseudo-code fragment, where $a$ and $b$ are integer variables that have been initialized: /* Pre-conditions : $(a > 1 \wedge a < b)$ */ /* Assume that overflow never occurs */ int $x=0$; int $p=1$; while $(p<b) \{$ $p=p*a$; $x=x+1$; $\}$ ... $\lfloor \: \: \rfloor$ means floor */ $\lfloor \log_a^b \rfloor$ /* $\lceil \: \: \rceil$ means ceil */
asked Nov 20, 2020 in Programming and DS jothee 549 views
2 votes
1 answer
5
Suppose you are compiling on a machine with $1$-byte chars, $2$-byte shorts, $4$-byte ints, and $8$-byte doubles, and with alignment rules that require the address of every primitive data element to be an integer multiple of the element's size. Suppose further that the compiler is not ... ; double r; int i; } A[10]; /*10 element array of structs */ $150$ bytes $320$ bytes $240$ bytes $200$ bytes
asked Nov 20, 2020 in Programming and DS jothee 481 views
0 votes
1 answer
6
3 votes
1 answer
7
An external variable is globally accessible by all functions has a declaration “extern” associated with it when declared within a function will be initialized to $0$ if not initialized all of these
asked Apr 2, 2020 in Programming Lakshman Patel RJIT 622 views
1 vote
1 answer
8
If initialization is a part of declaration of a structure, then storage class can be automatic register static anything
asked Apr 2, 2020 in Programming Lakshman Patel RJIT 349 views
1 vote
1 answer
9
For $x$ and $y$ are variables as declared below $\textit{double }x=0.005, \: y = – 0.01;$ What is the value of $\text{ceil }(x+y)$, where $\text{ceil }$ is a function to compute ceiling of a number? $1$ $0$ $0.005$ $0.5$
asked Apr 2, 2020 in Programming Lakshman Patel RJIT 271 views
0 votes
3 answers
10
In C programming language, if the first and the second operands of operator $+$ are of types int and float, respectively, the result will be of type int float char long int
asked Apr 2, 2020 in Programming Lakshman Patel RJIT 296 views
0 votes
1 answer
11
What will be the value of $x$ and $y$ after execution of the following statement(C language) n = 5; x = n++; y = -x; $5,-4$ $6,-5$ $6,-6$ $5,-5$
asked Apr 2, 2020 in Programming Lakshman Patel RJIT 227 views
0 votes
1 answer
12
The question is based on the following program fragment. f(intY[10],int x){ int u,j,k; i=0;j=9; do{ k=(i+j)/2; if(Y[k] < x) i=k; else j=k; } while((Y[k]!=x) && (i<j)); if (Y[k]==x) printf( x is in the array. ); else printf( x is not in the array. ); } On which of the following contents of ... $x>2$ $Y$ is $[2\;4\;6\;8\;10\;12\;14\;16\;18\;20]$ and $2<x<20$ and $'x'$ is even
asked Apr 1, 2020 in Programming Lakshman Patel RJIT 492 views
...