HackerRank String Manipulation Quiz-1

Question 1

Time: 00:00:00
Which among the following is true about Array?

i) are one dimensional character array

ii) always terminate by null character ‘\0’

iii) follows contiguous memory allocation.

iv) String Declaration is Char String_Name[Size];

i and ii

i and ii

ii ,iii,v

ii ,iii,v

 i ,iii,iv

 i ,iii,iv

 iv

 iv

All the above

All 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
We can take input by printf statement but also use _______.

print statement 

print statement 

puts statement

puts statement

 gets statement 

 gets statement 

scanf statement 

scanf statement 

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

Please login to submit your explanation

Start

Question 3

Time: 00:00:00
 We can take scanning elements by scanf statement but also use _______.

 

scanf statement 

scanf statement 

puts statement

puts statement

 print statement 

 print statement 

 gets statement 

 gets statement 

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 operations does #include<string.h> have :-

strlen

strlen

strcpy

strcpy

strcmp

strcmp

strcat

strcat

All the above

All the 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
 If we do not set String Size along with string Name and char keyword like char String Alpha[] ; ?

Compile time error

Compile time error

Runtime time error

Runtime time error

Automatically take the size of the string

Automatically take the size of the string

Syntax error

Syntax error

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
 How to initialize a string :-

char a [11] = "prepinsta";

char a [11] = "prepinsta";

char a [] = "prepinsta";

char a [] = "prepinsta";

char a [] = {'p','r','e','p','i','n','s','t','a','\0'};

char a [] = {'p','r','e','p','i','n','s','t','a','\0'};

 char a [11] = {'p','r','e','p','i','n','s','t','a','\0'};

 char a [11] = {'p','r','e','p','i','n','s','t','a','\0'};

 All

 All

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

Please login to submit your explanation

Start

Question 7

Time: 00:00:00
To compare two strings are identical, which function is used 

strcpy 

strcpy 

strcat

strcat

 strcmp

 strcmp

strcomp

strcomp

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
When we used strcat function adds null character

 Always

 Always

when needed null

when needed null

Only if there is space

Only if there is space

depends on the compiler

depends on the compiler

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
#include<stdio.h>
#include<string.h>
main()
{
char str1[30] = “Hello” , str2[30] = “Prepsters” ;
printf(“%s”,strcpy(str2, strcat(str1, str2)));
}

What is the output of the following code?


Hello Prepsters

Hello Prepsters

HelloPrepsters

HelloPrepsters

HelloPrepster

HelloPrepster

Hello 

Hello 

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 methods is used to obtain a length of String object?

length()

length()

size()

size()

sizeof()

sizeof()

lenthof()

lenthof()

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