Data Structures (3330704) MCQs

MCQs of Strings

Showing 11 to 17 out of 17 Questions
11.

If the two strings are identical, then strcmp() function returns _____.

( જો બે સ્ટ્રીંગ સમાન હોય, તો  strcmp () ફંક્શન ____ રીટર્ન કરે છે ).

(a)

-1

(b)

0

(c)

1

(d)

2

Answer:

Option (b)

12.

What is the output of given substring function?

s1 = "computer", cursor = 4, num = 3, write(XSUBSTR(s1, 4, 3))

નીચેના આપેલ substring ફંકશનનું આઉટપુટ શું છે?

s1 = "computer", cursor = 4, num = 3, write(XSUBSTR(s1, 4, 3))

(a)

ute

(b)

pute

(c)

put

(d)

mpu

Answer:

Option (a)

13.

State TRUE OR FALSE : String concat operation always  adds NULL character at end.

(આપેલ વિધાન સાચું છે કે ખોટું : સ્ટ્રીંગ કોન્કેટ ઓપેરશન સ્ટ્રીંગને અંતે NULL કેરેક્ટર ઉમેરે છે.)

(a)

TRUE

(b)

FALSE

Answer:

Option (a)

14.

What will be the output of given code?

(નીચે આપેલ પ્રોગ્રામનું આઉટપુટ શું આવશે?)

(a)

11HelloWorld

(b)

Hello World 11

(c)

10 Hello World

(d)

Hello World11

Answer:

Option (b)

15.

What will be the output of given code?

(નીચે આપેલ કોડનું આઉટપુટ શું આવશે?)

(a)

HI

(b)

HELLO

(c)

HIHELLO

(d)

HELLOHI

Answer:

Option (b)

16.

What will be the output of given code?

(નીચે આપેલ કોડનું આઉટપુટ શું આવશે?)

(a)

CAT

(b)

C

(c)

CAT\0

(d)

Compile Error

Answer:

Option (d)

17.

What will be the output of given code?

int main()
{
    char s[20], s1[20];
    printf("enter string");
    scanf("%s",s);
    printf("%s", s);
    scanf("%s",s1);
    printf("%s", s1);
}

Input : s :  HELLO WORLD 

           s1 : Welcome

નીચે આપેલ કોડનું આઉટપુટ શું આવશે?

int main()
{
    char s[20], s1[20];
    printf("enter string");
    scanf("%s",s);
    printf("%s", s);
    scanf("%s",s1);
    printf("%s", s1);
}

Input : s :  HELLO WORLD 

           s1 : Welcome

(a)

HELLOHELLO

(b)

Welcome

(c)

HELLOWORLD

(d)

HELLOWORLDWelcome

Answer:

Option (c)

Showing 11 to 17 out of 17 Questions