NEW
Font size
WorksheetsNo Strings Attached
Total questions: 20
Worksheet time: 8mins
Which string header should be included in your program to use String class?
string
character
strarr
stringclass
What is the length of the following string?
String str='Good morning!!!';
cout << str.length();
10
15
16
13
How many types of representation are in the string?
1
2
3
4
Which is used to return the number of characters in the string?
length
size
both length and size
none of the above
What is the output of the following code?
String str1 = 'All' + ' ' + 'the' + ' ' + 'best!!';
cout << str1;
Allthebest!!
Allthebest
All the best!!
All the best
Select the output of this snipplet
char str[] = "geeksforgeeks";
cout << 6[str];
e
k
s
o
Which of the following classes is output stream in C++
stdin
ifstream
ofstream
iostream
Which of the following streams is standard output in C++
stdout
cerr
cout
Which of the following reads in a string named x with one hundred characters?
cin.getline(x, 100, '\n');
cin.getline(100, x, '\n');
readline(x, 100, '\n');
read(x);
Which of the following functions compares two strings?
compare();
stringcompare();
cmp();
strcmp();
Which of the following adds one string to the end of another?
append();
stringadd();
strcat();
stradd();
All these strncpy ( ), strstr ( ), strok( ), strchr ( ) functions belongs to
<iostream.h>
<stdlib.h>
<string.h>
<array.h>
Which operator is suitable for concatenation function of a string class?
<
<<
++
+
For finding number of characters in string, which function is used?
str_len()
str()
strsize()
strlen()
A string is terminated by a
Null character
Boolean Expression
Semicolon
All of the them
Sequence of contiguous characters in memory, is called as
Functions
Character strings
Arrays
String
What is mean of concatenation?
Separating a string from another string
Adding two functions
Adding two strings
one of them
string s1 = "Welcome to javatpoint";
int len = s1.length();
Give the value of len
19
20
21
22
char str1[] = "user";
char str2[] = "User";
int result = strcmp(str1, str2);
What will be the value of result?
0
1
Null
None
char str1[] = "user";
char str2[] = "user";
int result = strcmp(str1, str2);
What will be the value of result?
0
1
Null
none
