Quiz- 1

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);
}

strchr()

strchr()

strrchr()

strrchr()

strstr()

strstr()

strnset()

strnset()

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 is stderr?

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.

Please login to submit your explanation

Start

Question 3

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

#include

int main()
{
int i;
char c;
for(i=1; i<=5; i++)
{
scanf("%c", &c); /* given input is 'b' */
ungetc(c, stdout);
printf("%c", c);
ungetc(c, stdin);
}
return 0;
}

2, 2, 0, 1

2, 2, 0, 1

1, 2, 1, 0

1, 2, 1, 0

-2, 2, 0, 0

-2, 2, 0, 0

-2, 2, 0, 1

-2, 2, 0, 1

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 the output of the program?

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

 

The letter is a Now the letter is A

The letter is a Now the letter is A

The letter is A Now the letter is a

The letter is A Now the letter is a

Error

Error

None of above

None of above

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 will be the output of the program?

#include
int main()
{
char ch;
ch = 'A';
printf("The letter is");
printf("%c", ch >= 'A' && ch <= 'Z' ? ch + 'a' - 'A':ch);
printf("Now the letter is"); printf("%c\n", ch >= 'A' &&
ch <= 'Z' ? ch : ch + 'a' - 'A');
return 0;
}

 

Error: Declaration syntax

Error: Declaration syntax

Error: Expression syntax

Error: Expression syntax

Error: LValue required

Error: LValue required

Error: Rvalue required

Error: Rvalue required

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

Please login to submit your explanation

Start

Question 6

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

#include

int main()
{
int a[] = {10, 20, 30, 40, 50};
int j;
for(j=0; j<5; j++)
{
printf("%d\n", a);
a++;
}
return 0;
}

 

1

1

2

2

3

3

4

4

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 be the output of the program ?

#include
void fun(int **p);

int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
int *ptr;
ptr = &a[0][0];
fun(&ptr);
return 0;
}
void fun(int **p)
{
printf("%d\n", **p);
}

 

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.

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Which of the following statements are correct about an array?
1: The array int num[26]; can store 26 elements.
2: The expression num[1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num[SIZE] is allowed if SIZE is a macro.

1

1

1,4

1,4

2,3

2,3

2,4

2,4

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Identify which of the following are declarations
1 : extern int x;
2 : float square ( float x ) { ... }
3 : double pow(double, double);

1

1

2

2

3

3

1 & 3

1 & 3

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 of the following function is used to find the first occurrence
of a given string in another string?

bbbb

bbbb

bbbbb

bbbbb

b

b

Error in ungetc statement.

Error in ungetc statement.

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! \r\n","Keep trying! \r\n","Not bad! \r\n","Good work! \r\n","Perfect! \r\n"]

Personalized Analytics only Availble for Logged in users

Analytics below shows your performance in various Mocks on PrepInsta

Your average Analytics for this Quiz

Rank

-

Percentile

0%

Completed

0/10

Accuracy

0%

Get Prepinsta Prime

Get all 200+ courses offered by Prepinsta

Never Miss an OffCampus Update

Get OffCampus Updates on Social Media from PrepInsta

Follow us on our Media Handles, we post out OffCampus drives on our Instagram, Telegram, Discord, Whatsdapp etc.

Get Hiring Updates
Amazon,Google,Delottie & 30+companies are hiring ! Get hiring Updates right in your inbox from PrepInsta

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others.

Get PrepInsta Prime Subscription

Get access to all the courses that PrepInsta offers, check the out below -

Companies

TCS, Cognizant, Delloite, Infosys, Wipro, CoCubes, KPMG, Amazone, ZS Associates, Accenture, Congnizant & other 50+ companies

Programming

Data Structures, Top 500 Codes, C, C++, Java Python & other 10+ subjects

Skills

Full Stack Web Development, Data Science, Machine Learning, AWS Cloud, & other 10+ skills and 20+ projects

Comments