Question
Question 6 (1 point) Using the == operator on a string variable results in the same value as using strcmp on two c-strings. Question 6
Question 6 (1 point)
Using the == operator on a string variable results in the same value as using strcmp on two c-strings.
Question 6 options:
True | |
False |
Save
Question 7 (1 point)
Which of the following returns the fourth character in the string variable named str and checks if there is a fourth character in the string?
Question 7 options:
str(3); | |
str.at(3); | |
str[3]; | |
All of the above |
Save
Question 8 (1 point)
What is the difference between strcmp and strncmp?
Question 8 options:
No difference | |
they both compare, one expects an integer for the number of characters to compare. | |
one copies, the other compares | |
They are in different libraries |
Save
Question 9 (1 point)
What is the value of str after the following code? string str;
Question 9 options:
a garbage string | |
the empty string | |
the null character | |
unknown |
Save
Question 10 (1 point)
Given the following declarations, which of the following is legal syntax? string str="Your name"; char c_string[20]="My name";
Question 10 options:
str = c_string; | |
c_string = str; | |
strcpy(c_string, str.c_str()); | |
strcpy(c_string, str); | |
A and C |
Save
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started