HackerRank String Manipulation Quiz-2

Question 1

Time: 00:00:00
#include<stdio.h>
#include<string.h>
main()
{
printf(8+“Welcome PrepInsta”);
}


What is the output of the following code?

Welcome

Welcome

PrepInst

PrepInst

PrepInsta

PrepInsta

8Welcome PrepInsta

8Welcome PrepInsta

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

Please login to submit your explanation

Start

Question 2

Time: 00:00:00
Which of these syntax returns a String that represents the character sequence in the array specified?

 public static String copyValueOf(char[] data)

 public static String copyValueOf(char[] data)

public static String copyEndOf(char[] data)

public static String copyEndOf(char[] data)

public static String BooleanValueOf(char[] data)

public static String BooleanValueOf(char[] data)

public static String copyCat(char[] data)

public static String copyCat(char[] data)

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 are the string library functions used to detect a character's last occurrence ?

strrchr()

strrchr()

strrchr(void)

strrchr(void)

 laststr()

 laststr()

strstr()

strstr()

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

Please login to submit your explanation

Start

Question 4

Time: 00:00:00
#include<stdio.h>
#include<string.h>
void main()
{
char str[] = "PrepInsta\0Prepster";
printf("%s",str);
}


What is the output of the following code?

PrepInsta

PrepInsta

PrepInsta Prepster

PrepInsta Prepster

Prepster

Prepster

PrepInsta\0Prepster

PrepInsta\0Prepster

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 of the following claims concerning string is not true

StringBuffer class is used to store string in a buffer for later use

StringBuffer class is used to store string in a buffer for later use

String objects are immutable, they cannot be changed

String objects are immutable, they cannot be changed

String object can point to some other reference of String variable

String object can point to some other reference of String variable

All are incorrect

All are incorrect

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

Please login to submit your explanation

Start

Question 6

Time: 00:00:00
class String
{
public static void main(String args[])
{
char var[] = {'p', 'r', 'e','p','i','n','s','t','a'};
String str = new String(var);
System.out.println(str);
}
}


What is the output of the following Java program?

prep

prep

 prepinsta

 prepinsta

 insta

 insta

none

none

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 do mean by string concatenation?

 merge the two string 

 merge the two string 

combine the two string 

combine the two string 

comparing the two string 

comparing the two string 

add the two string 

add the two string 

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

Please login to submit your explanation

Start

Question 8

Time: 00:00:00
Whether one of the class string methods is used to retrieve a single character from a String object? 

charAt()

charAt()

Charat()

Charat()

 charat()

 charat()

CharAt()

CharAt()

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

Please login to submit your explanation

Start

Question 9

Time: 00:00:00
class String 
{
public static void main (String args[])
{
int ascii[] = { 66, 68, 65, 67 ,69};
String str = new String (ascii, 1, 4);
System.out.println (str);
}
}


What is the output of the following Java program?

BDACE

BDACE

DACE

DACE

ABCE

ABCE

DE

DE

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

Please login to submit your explanation

Start

Question 10

Time: 00:00:00
 If any of the given String functions is used to clarify whether a given object begins with a specific literal string?

startsWith()

startsWith()

StartWith()

StartWith()

start()

start()

startPar()

startPar()

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