5. Which one of the following statements declares a c-string variable?
a.char c;
b. string s;
c. char c[10];
d.string s[10];
6. ________________ function returns the uppercase version of expression.
a. tolower(expression);
b. upper(expression)
c. toupper(expression);
d. isupper(expression);
7. Which of the following creates a string object with data ‘csci-1410’?
a. string str;
b. string ‘csci-1410’;
c. string s("csci-1410");
d. string s(csci-1410);
5. Which one of the following statements declares a c-string variable? a.char c; b. string s;...
Multiple choice questions 1. A variable that is shared by all objects of a class is called_________? A.Static variable B. Const variable C.Member variable D. None of the above 2. Each object of a class has its own copy of the class's: A. member functions B. static member variables C. instance member variables D. A & C E. A & B 3. In a vector, which of the following statements is true? (can have multiple answers) a) Indexing vector access...
C++ programing
Which of the following statements (a-d) are true if the following lines of code are executed? int G = 17; int &H = G; A. H is now an alternate name for G B. Adding 1 to H will change the value of G to 18 C. Subtracting 5 from G and printing H will display the value 12 D. The condition H == G will give a true result E. All of the statements (a-d) are true...
Using C,
Write a function reverse which takes a string as an argument, reverses the string and returns the reversed string. Note; you should not return a string that you created inside the reverse function! For example: Test char str[]-"hello" printf("%s", reverse (str)); Result olleh
#include <iostream> #include <cstring> #include <string> #include <istream> using namespace std; //Function prototypes int numVowels(char *str); int numConsonants(char *str); int main() { char string[100]; char inputChoice, choice[2]; int vowelTotal, consonantTotal; //Input a string cout << "Enter a string: " << endl; cin.getline(string, 100); do { //Displays the Menu cout << " (A) Count the number of vowels in the string"<<endl; cout << " (B) Count...
#include <iostream> #include <cstring> #include <string> #include <istream> using namespace std; //Function prototypes int numVowels(char *str); int numConsonants(char *str); int main() { char string[100]; char inputChoice, choice[2]; int vowelTotal, consonantTotal; //Input a string cout << "Enter a string: " << endl; cin.getline(string, 100); do { //Displays the Menu cout << " (A) Count the number of vowels in the string"<<endl; cout << " (B) Count...
Question 39 (1 point) Which one of the following statements can be used to get the fifth character from a string str? char c - str.charAt(4): char c - str[5]: char c = str(4): char c - str.charAt(5): Question 40 (1 point) What does the following statement sequence print If the user input is 1234 public static void main(String args) Scanner in new Scanner (System.in); System.out.print("Enter a number: "); String strin.next( St 456; System.out.println(str) Compile-time error 123456 579 Run-time error
Write C programs named mystring.h and mystring.c, containing the headers and implementations of the following functions. int letter_count(char *s) computes and returns the number of English letters in string s. int word_count(char *s) computes and returns the number of words in string s. void lower_case(char *s) changes upper case to lower case of string s. void trim(char *s) removes the unnecessary empty spaces of string s. mystring.h #include <stdio.h> int letter_count(char *); void lower_case(char *); int word_count(char *); void trim(char...
In
C# (sharp)
Assuming a string variable named movie Title has already been declared, which one of the following statements combines the strings "Hidden" and "Figures" and then assigns the resulting string to the variable? 1. movieTitle="Hidden" + "Figures"; 2. "Hidden" +"Figures" - moveTitle; 3. movie Title("Hidden" +"Figures"); 4. movie title="Hidden" & "Figures": Look at the following code: int distance; // Declare distance as an int double half://Declare half as a double distance = 35; // Assign 35 to distance...
c. [3 marks] Given the following definition of the class MyClass, class MyClass { String s int z Myclass(int y) { z = y } } fill in the blanks (labelled i., ii. and iii.) in the definition of the method main, of the class StringProcessing, with i. a declaration of a variable named obj of type MyClass, initialised with a MyClass object so that its instance variable z has a value of 20, ii. an assignment of the instance...
Question 15 Which of the following statements will convert the string, str = "285" to an int? A int x = str; B int x = Integer.integer(str); C int x = Integer.parseInteger(str); D int x = Integer.parseInt(str);