Please login

Prime

Prepinsta Prime

Video courses for company/skill based Preparation

(Check all courses)
Get Prime Video
Prime

Prepinsta Prime

Purchase mock tests for company/skill building

(Check all mocks)
Get Prime mock

C Input Output Questions 2

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
The function below fact is given a value of 200.
int fact(int a)
{
if(a==0)
{
return 0;
}
else
return (a + fact(a-2));
}


What value will the function return in the end?

19800

19800

10100

10100

20200

20200

25250

25250

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 printed after execution of the following code?
#include <stdio.h>
int main()
{
int x=50;
printf("%d", 1+x++);
}

50

50

52

52

Error message

Error message

51

51

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
What will be printed by the following code ?
#include <stdio.h>
int main()
{
printf("Hello Every\rone");
return 0;
}

onelo Every

onelo Every

Hello Every one

Hello Every one

Hello Every one

Hello Every one

oneHello Every

oneHello Every

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
What will be printed by he following code if the input given is "Raam"?
#include<stdio.h>
int main()
{
char arr[100];
printf("%d",scanf("%s",arr));
}

Raam

Raam

R

R

4

4

1

1

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

Please login to submit your explanation

Start

Question 5

Time: 00:00:00
What is the expected output of the code below?
#include <stdio.h>
int main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}

4 3 2 1

4 3 2 1

4 3 2 1 0

4 3 2 1 0

0 0 0 0 0

0 0 0 0 0

0 0 0 0

0 0 0 0

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
Select the correct option.

gets() can read a string a string with spaces but scanf("%s",arr) can not

gets() can read a string a string with spaces but scanf("%s",arr) can not

gets() can read a string with escape line sequences but scanf("%s",arr) can not.

gets() can read a string with escape line sequences but scanf("%s",arr) can not.

scanf() can always be replaced with gets() without any change.

scanf() can always be replaced with gets() without any change.

None of the options are correct

None of the options are correct

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
What will the printed upon the execution of this program if the given input is Atulya?
#include <stdio.h>
int main()
{
char str[10];
scanf("%4s",str);
printf("%s",str);
}

Atulya

Atulya

Will show error because of "4%" in scanf

Will show error because of "4%" in scanf

lya

lya

Atul

Atul

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 will be the output of the following code?
#include<stdio.h>

int main()
{
char *s = "Prep Insta";
int n = 7;
printf("%.*s", n, s);
return 0;
}

Prep In

Prep In

Prep Insta

Prep Insta

sta

sta

Prep

Prep

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 output of the code below ?
#include<stdio.h>
char *getString()
{
char str[] = "Best site for placement!";
return str;
}
int main()
{
printf("%s", getString());
}

Best site for placement!

Best site for placement!

Segmentation core dump.

Segmentation core dump.

(null)

(null)

Will show error in printing the string.

Will show error in printing the string.

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
Which one of the following is true for a CPU with memory mapped I/O?

System configuration enables I/O protection.

System configuration enables I/O protection.

I/O protection is not achievable

I/O protection is not achievable

I/O protection is enabled by operating system routine

I/O protection is enabled by operating system routine

I/O protection is ensured by a hardware trap

I/O protection is ensured by a hardware trap

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!"]