search
Log In

Recent questions tagged programming-in-c

0 votes
1 answer
1
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 in Programming Lakshman Patel RJIT 324 views
0 votes
1 answer
2
What will be the output of following? main() { Static int a = 3; Printf(“%d”,a--); If(a) main(); } $3$ $3\;2\;1$ $3\;3\;3$ Program will fall in continuous loop and print $3$
asked Apr 1 in Programming Lakshman Patel RJIT 178 views
0 votes
1 answer
3
0 votes
2 answers
4
0 votes
2 answers
5
What will be the output of following? main() { Static int a = 3; Printf(“%d”,a--); If(a) main(); } $3$ $3\;2\;1$ $3\;3\;3$ Program will fall in continuous loop and print $3$
asked Apr 1 in Programming Lakshman Patel RJIT 120 views
0 votes
0 answers
6
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 in Programming Lakshman Patel RJIT 101 views
1 vote
1 answer
7
Which of the following is illegal declaration in $C$ language? char*str ="Raj is a Research scholar"; char str[25] ="Raj is a Research scholar"; char str[40] ="Raj is a Research scholar"; char[]str ="Raj is a Research scholar";
asked Mar 31 in Programming Lakshman Patel RJIT 197 views
1 vote
3 answers
8
What is the correct way to round off $x$, $a$ $\text{float}$ to an $\text{int}$ value? $y=(\text{int})(x+0.5)$ $y=\text{int} (x+0.5)$ $y=(\text{int}) x+0.5$ $y=(\text{int})(\text{int})x+0.5)$
asked Mar 31 in Programming Lakshman Patel RJIT 213 views
2 votes
6 answers
9
What error would the following function give on compilation? f(int a, int b) { int a; a=20; return a; } Missing parenthesis is $\textit{return}$ statement. Function should be defined as $\text{int f(int a, int b)}$ Redeclaration of $a$. None of these.
asked Mar 31 in Programming Lakshman Patel RJIT 585 views
2 votes
1 answer
10
0 votes
1 answer
11
Output of the following loop is for(putchar('c');putchar ('a');putchar('r')) putchar('t'); a syntax error. cartrt. catrat. catratratratrat...
asked Mar 31 in Programming Lakshman Patel RJIT 104 views
0 votes
0 answers
12
If space occupied by two strings $s_1$ and $s_2$ in 'C' are respectively $m$ and $n$, then space occupied by string obtained by concatenating $s_1$ and $s_2$ is always less than $m+n$ equal to $m+n$ greater than $m+n$ none of these
asked Mar 31 in Programming Lakshman Patel RJIT 115 views
0 votes
1 answer
13
The maximum combined length of the command-line arguments including the spaces between adjacent arguments is: $128$ characters $256$ characters $67$ characters It may very from one Operating System to another
asked Mar 31 in Programming Lakshman Patel RJIT 116 views
2 votes
2 answers
14
What is the meaning of following declaration? int(*p[7])(); $p$ is pointer to function $p$ is pointer to such function which return type is array $p$ is array of pointer to function $p$ is pointer to array of function
asked Mar 31 in Programming Lakshman Patel RJIT 199 views
1 vote
1 answer
16
What will be output if you will compile and execute the following C code? void main(){ char c=125; c=c+10; printf("%d",c); } $135$ $115$ $-121$ $-8$
asked Mar 31 in Programming Lakshman Patel RJIT 227 views
1 vote
6 answers
17
1 vote
2 answers
18
Output of following program #include<stdio.h> int main() { int i=5; printf("%d %d %d", i++,i++,i++); return 0; } $7\:6\:5$ $5\:6\:7$ $7\:7\:7$ Compiler Dependent
asked Mar 30 in Programming Lakshman Patel RJIT 175 views
1 vote
1 answer
19
Output of following program? #include<stdio.h> void dynamic(int s,...) { printf("%d",s); } int main() { dynamic(2,4,6,8); dynamic(3,6,9); return 0; } $2\:3$ Compiler Error $4\:3$ $3\:2$
asked Mar 30 in Programming Lakshman Patel RJIT 135 views
0 votes
2 answers
20
Output of following program? #include<stdio.h> int main() { int *ptr; int x; ptr=&x; *ptr=0; printf("x=%d\n",x); printf("*ptr=%d\n",*ptr); *ptr+=5; printf("x=%d\n",x); printf("*ptr=%d\n",*ptr); (*ptr)++; printf( x=%d\n",x); printf("*ptr=%d\n",*ptr); return 0; } $x=0$ $^*ptr=0$ ... $^*ptr=0$ $x=5$ $^*ptr=5$ $x=$garbage value $^*ptr=$garbage value $x=0$ $^*ptr=0$ $x=0$ $^*ptr=0$ $x=0$ $^*ptr=0$
asked Mar 30 in Programming Lakshman Patel RJIT 87 views
1 vote
1 answer
21
Assume that float takes $4$ bytes, predict the output of following program. #include<stdio.h> int main() { float arr[5]={12.5,10.0,13.5,90.5,0.5}; float *ptr1=&arr[0]; float *ptr2=ptr1+3; printf("%f",*ptr2); printf("%d",ptr2-ptr1); return 0; } $90.500000\:\:3$ $90.500000\:\:12$ $10.000000\:\:12$ $0.500000\:\:3$
asked Mar 30 in Programming Lakshman Patel RJIT 155 views
1 vote
1 answer
22
Assume that size of an integer is $32$ bit. What is the output of following ANSI C program? #include<stdio.h> struct st { int x; static int y; }; int main() { printf(%d",sizeof(struct st)); return 0; } $4$ $8$ Compiler Error Runtime Error
asked Mar 30 in Programming Lakshman Patel RJIT 144 views
1 vote
1 answer
23
#include<stdio.h> struct st { int x; struct st next; }; int main() { struct st temp; temp.x=10; temp.next=temp; printf("%d",temp.next,x); return 0; } Compiler Error $10$ Runtime Error Garbage Value
asked Mar 30 in Programming Lakshman Patel RJIT 173 views
1 vote
2 answers
24
Following is C like Pseudo code of a function that takes a number as an argument, and uses a stack S to do processing. void fun(int n) { Stack S;//Say it creates an empty stack S while(n>0) { // This line pushes the value of n%2 to stack S; Push(&S,n%2); n=n ... $n$ in reverse order. Prints binary representation of $n$. Prints the value of $\log n$. Prints the value of $\log n$ in reverse order.
asked Mar 30 in Programming Lakshman Patel RJIT 154 views
2 votes
5 answers
25
What is the output of the following $C$-program main() { printf("%d %d %d",size of (3.14f), size of (3.14), size of (3.141)); } 4 4 4 4 8 10 8 4 8 8 8 8
asked Mar 27 in Programming jothee 527 views
1 vote
2 answers
26
After $3$ calls of the $c$ function bug ( ) below, the values of $i$ and $j$ will be : int j = 1; bug () { static int i = 0; int j = 0; i++; j++; return (i); } $i = 0, j = 0$ $i = 3, j = 3$ $i = 3, j = 0$ $i = 3, j = 1$
asked Mar 26 in Programming jothee 395 views
1 vote
8 answers
27
Find the output of the following $“C”$ code : Main() { int x=20, y=35; x=y++ + x++; y=++y + ++x; printf (“%d, %d\n”, x, y); } $55, 93$ $53, 97$ $56, 95$ $57, 94$
asked Mar 26 in Programming jothee 478 views
3 votes
2 answers
28
Main() { char *str="abcde"; printf("%c",*str); printf("%c",*str++); printf("%c",*(str++)); printf("%s",str); } The output of the above $‘C’$ code will be : $\text{a a c b c d e}$ $\text{a a c c c d e}$ $\text{a a b c d e}$ None of these
asked Mar 26 in Programming jothee 220 views
0 votes
1 answer
29
Which of the following storage classes have global visibility in $C/C++$? Auto Extern Static Register
asked Mar 24 in Programming and DS jothee 172 views
12 votes
4 answers
30
Consider the following C program. #include <stdio.h> int main () { int a[4] [5] = {{1, 2, 3, 4, 5}, {6, 7,8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17,18, 19, 20}}; printf(“%d\n”, *(*(a+**a+2)+3)); return(0); } The output of the program is _______.
asked Feb 12 in Programming Arjun 4.3k views
...