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

Zoho Strings Quiz 1

Question 1

Time: 00:00:00
Which of the following C code snippet is not valid?

char* p = “string1”; printf(“%c”, *++p);

char* p = “string1”; printf(“%c”, *++p);

char q[] = “string1”; printf(“%c”, *++q);

char q[] = “string1”; printf(“%c”, *++q);

char* r = “string1”; printf(“%c”, r[1]);

char* r = “string1”; printf(“%c”, r[1]);

None of the above

None of the above

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Consider the following C program segment: (GATE CS 2004).

char p[20];
char *s = "string";
int length = strlen(s);
int i;
for (i = 0; i < length; i++)
p[i] = s[length — i];
printf("%s",p);

gnits

gnits

gnirts

gnirts

string

string

no output is printed

no output is printed

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 does the following fragment of C-program print?

char c[] = "GATE2011";
char *p =c;
printf("%s", p + p[3] - p[1]) ;

gate2011

gate2011

E2011

E2011

2011

2011

11

11

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 following program ?

#include <stdio.h>
#include <string.h>
int main()
{
int val=0;
char str[]="IncludeHelp.Com";

val=strcmp(str,"includehelp.com");
printf("%d",val);
return 0;
}

1

1

-1

-1

error

error

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

Please login to submit your explanation

value less than zero will be the output when the string str is less than the other which is compared.if both are same the output will be 0.so here I think the output will be 1.

Start

Question 5

Time: 00:00:00
What will be the output of following program ?
#include <stdio.h>
#include <string.h>

int main()
{
char str[];
strcpy(str,"Hello");
printf("%s",str);
return 0;
}

Hello

Hello

error

error

No output

No output

None

None

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 the output of following program ?
#include <stdio.h>
#include <string.h>
int main()
{
char str1[]="IncludeHelp",str2[]=".Com";
printf("%s",str1+strlen(str2));
return 0;
}

IncludeHelp.Com

IncludeHelp.Com

udeHelp

udeHelp

Error

Error

IncludeHelp4

IncludeHelp4

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

#include<stdio.h>
void swap(char *str1, char *str2)
{
char *temp = str1;
str1 = str2;
str2 = temp;
}

int main()
{
char *str1 = "Geeks";
char *str2 = "Quiz";
swap(str1, str2);
printf("str1 is %s, str2 is %s", str1, str2);
return 0;
}

str1 is Quiz, str2 is Geeks

str1 is Quiz, str2 is Geeks

str1 is Geeks, str2 is Quiz

str1 is Geeks, str2 is Quiz

str1 is Geeks, str2 is Geeks

str1 is Geeks, str2 is Geeks

str1 is Quiz, str2 is Quiz

str1 is Quiz, str2 is Quiz

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 following program ?

#include <stdio.h>
#include <string.h>
int main()
{
char str[50]="IncludeHelp";
printf("%d...%d",strlen(str),sizeof(str));
return 0;
}

50...50

50...50

11...50

11...50

11...11

11...11

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
Predict the output of the following program:

#include <stdio.h>
int main()
{
char str[] = "%d %c", arr[] = "GeeksQuiz";
printf(str, 0[arr], 2[arr + 3]);
return 0;
}

G Q

G Q

71 81

71 81

71 Q

71 Q

Compile time error

Compile time error

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
int main()
{
char p[] = "geeksquiz";
char t;
int i, j;
for(i=0,j=strlen(p); i<j; i++)
{
t = p[i];
p[i] = p[j-i];
p[j-i] = t;
}
printf("%s", p);
return 0;
}

Output ?

ziuqskeeg

ziuqskeeg

Nothing is printed on the screen

Nothing is printed on the screen

geeksquiz

geeksquiz

ggggggg

ggggggg

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

Completed

0/0

Accuracy

0%

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%