C Input Output Questions

Hello PrepSter,

If you find any errors in the quiz below kindly comment in the comment section and we will make it our priority to fix it.

Also if you have a better of the solution to the questions, please do comment them below and if we find it better than ours, we will post it in our website.

Question 1

Time: 00:00:00
What is the expected output of the code below ?
#include <stdio.h>
int main()
{
  printf(3+ "PrepSter");
  return 0;
}

PrepSter

PrepSter

3PrepSter

3PrepSter

pSter

pSter

Some garbage value

Some garbage value

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
What  will be the output of the following C code ?
#include <stdio.h>
int main()
{
printf("%c","PrepSter"[4]);
return 0;
}

 

Ster

Ster

S

S

p

p

Error command

Error command

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
Observe the C code below.
#include <stdio.h>
int main()
{
printf("\"TCS %% Wipro %% Infosys\"");
return 0;
}

What will be printed after compilation of this code?

\"TCS %% Wipro %% Infosys\"

\"TCS %% Wipro %% Infosys\"

"TCS %% Wipro %% Infosys\"

"TCS %% Wipro %% Infosys\"

TCS %% Wipro %% Infosys\

TCS %% Wipro %% Infosys\

"TCS % Wipro % Infosys"

"TCS % Wipro % Infosys"

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
Given an input string : Prepinsta

What will be the output of the following code ?
#include <stdio.h>
int main()
{
int i;
char str[10];
scanf("%4s", str);
for(i=0;i<4;i++)
{
printf("%c",str[i]);
}
return 0;
}

 

insta

insta

PrepintaPrepintaPrepintaPrepinta

PrepintaPrepintaPrepintaPrepinta

Prepinsta

Prepinsta

Prep

Prep

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
Choose the correct output for the C code below.
#include <stdio.h> 
int main()
{
int a;
a=printf("Placement");
printf("%d",a);
return 0;
}

Placement9

Placement9

PlacementPlacement

PlacementPlacement

Placement

Placement

Placement Placement

Placement Placement

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
What will be printed after executing this C code ?
#include<stdio.h>
int main()
{
printf("%d", printf("%d", 12345));
return 0;
}

512345

512345

1234512345

1234512345

123455

123455

Error detected

Error detected

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
Return type of getchar() is ?

char

char

pointer to char

pointer to char

float

float

int

int

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
What is the correct output option for the following code ?
#include "stdio.h"
int main()
{
int a = 0;
int b = 5;
printf("%d",(a+1),(b=a+2));
printf(" %d",(b=a+4));
return 0;
}

Error because of extra argument i.e b=a+2

Error because of extra argument i.e b=a+2

1 2

1 2

1 4

1 4

1 6

1 6

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
What is the expected result of the following C code ?
#include "stdio.h"
int pit(int x)
{
printf("%d",x);
return 0;
}
int main()
{
pit;
return 0;
}

0

0

Will show compilation error for missing parenthesis.

Will show compilation error for missing parenthesis.

Some garbage value will be printed

Some garbage value will be printed

The function pit will be complied but no value will be printed.

The function pit will be complied but no value will be printed.

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
What will be printed after the execution of the following code ?
#include <stdio.h>
struct pre{
char x, y, z;
};
int main() {
struct pre p = {'1', '0', 'a' + 3};
struct pre *q = &p;
printf("%c, %c", *((char *)q + 1), *((char *)q + 2));
return 0;
}

0, a+3

0, a+3

0, d

0, d

'0', 'a+3'

'0', 'a+3'

'0','d'

'0','d'

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

Please login to submit your explanation

Start

["0","40","60","80","100"]
["Need more practice!","Keep trying!","Not bad!","Good work!","Perfect!"]