# Wipro Turbo Quiz on C with Answers

Question 1

Time: 00:00:00
Consider following given the code and predict its output.
```main()
{
int num[ ] = {1,4,8,12,16};
int *a,*b; int i; a=num; b=num+2;
i=*a+1;
printf("%d,%d,%d\n",i,*a,*b);
}```

2,1,8

2,1,8

4,1,8

4,1,8

4,4,8

4,4,8

2,4,8

2,4,8

Once you attempt the question then PrepInsta explanation will be displayed.

a=num[0] b=index of num[0]+2=8 i=address of num[0] +1=4 i=4 a=1 b=8

a=num[0] ; b=increment the index value i=*a+1

a=num[0] =1 b=num[0]+2=1+2=3 i=*a+1=pointer(1)+1=1+1=2 Therefore i=2 *a=pointer(1)=1 *b=pointer(3)=8

Start

Question 2

Time: 00:00:00
What is stderr?

standard error

standard error

standard error types

standard error types

standard error streams

standard error streams

standard error definitions

standard error definitions

Once you attempt the question then PrepInsta explanation will be displayed.

The standard error stream is the default destination for error messages and other diagnostic warnings. Like stdout, it is usually also directed by default to the text console (generally, on the screen).

Start

Question 3

Time: 00:00:00
```What will be the output of the program for the input 'c'?

#include
int main()
{
int i;
char c;
for(i=1; i<=5; i++)
{
scanf("%c", &c);
printf("%c", c);
ungetc(c, stdin);
}
return 0;
}
```

cccc

cccc

c

c

ccccc

ccccc

Error in ungetc statement.

Error in ungetc statement.

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 4

Time: 00:00:00
```What will be the output of the program?

#include
int main()
{
int i=-3, j=2, k=0, m;
m = i+(j++);
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}```

2, 2, 0, 1

2, 2, 0, 1

1, 2, 1, 1

1, 2, 1, 1

-2, 2, 0, 0

-2, 2, 0, 0

-3, 3, 0,- 1

-3, 3, 0,- 1

Once you attempt the question then PrepInsta explanation will be displayed.

Since i is incremented, it becomes -2 j remians the same k remains 0 m is incremented thrice as ++i and becomes 0

Start

Question 5

Time: 00:00:00
```What will be the output of the program?
#include<stdio.h>
int main()
{
char ch;
ch = 'P';
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'p' - 'P':ch);
return 0;
}```

P

P

p

p

Error

Error

None of above

None of above

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 6

Time: 00:00:00
```Point out the error in the program?

#include<stdio.h>
int main()
{
int a[] = {7657,7253,9242,5297,2958};
int j;
for(j=0; j<5; j++)
{
printf("%d\n", a);
a[j]++;
}
return 0;
}```

Syntax error

Syntax error

Lvalue required

Lvalue required

No errors but prints garbage values

No errors but prints garbage values

Rvalue required

Rvalue required

Once you attempt the question then PrepInsta explanation will be displayed.

a++ is the short form of a = a + 1. However, a here is an array and you cannot modify the address of an array. So, the error is LValue required.

literals are RValue with with no address, so a++ operation need address thus we get LValue error

Start

Question 7

Time: 00:00:00
```#include<stdio.h>
void solve(int **p);

int main()
{
int arr[3][4] = {197, 22, 33, 44, 64, 43, 12, 87, 74, 88,39,90};
int *p;
p= &arr[0][0];
solve(&p);
return 0;
}
void solve(int **p)
{
printf("%d\n", **p);
}```

197

197

88

88

43

43

22

22

Once you attempt the question then PrepInsta explanation will be displayed.

Start

Question 8

Time: 00:00:00
```Which among the following are declarations
1 : double solve(int);
2 : int fun(int A) { ... }
3 : extern int P;```

1

1

2

2

3

3

1 & 3

1 & 3

Once you attempt the question then PrepInsta explanation will be displayed.

2 nd statement definition of function.

Start

Question 9

Time: 00:00:00
Which function returns the first occurrence of a character within a string

strstr()

strstr()

strrchr()

strrchr()

strchr()

strchr()

strnset()

strnset()

Once you attempt the question then PrepInsta explanation will be displayed.

strstr(a,b) returns first occurrence of \'b\' string in \'a \' string. It returns index position.

Start

Question 10

Time: 00:00:00
```Which of the following statements are correct about an array?
1: ar[9] can store 9 elements
2: ar[2] gives you the second element of the array
3: you must initialize array at declaration of array```

1,2

1,2

only 1

only 1

2,3

2,3

All 1,2,3

All 1,2,3

Once you attempt the question then PrepInsta explanation will be displayed.