a collection of similar data type value in a single _____.
array
String is a collection of group of character, it is achieved in C++ language by using array character. The string in C++ language is a one dimensional array of character which is terminated by a null character. What is the symbol for null character?
\0
It is a derived data type in C++, which is constructed from the fundamental data type of _____ language.
C++
What is the purpose of strcat(s1);?
Concatenates string s2 onto the end of string s1
What is the simplest form of an array?
one-dimension
The lowest address corresponds to the _____ and the _____ address to the last element.
first element, highest
Enumerate the two types of String.
1. C-Style Character String
2. String Class in C++
An array is used to store a collection of _____.
What is the purpose of strlen(s1);?
Returns the length of string s1.
What is the syntax to declare two-dimensional array is C++?
data type array_name[][];
The first digital computers used _____ language programming to set up and access array structures for data tables, vector and matrix computations, and for many other purposes.
machine
This string is actually a one-dimensional array of characters which is terminated by a null character ‘\0’.
C-Style Character String
Enumerate at least three (3) programming languages that were mentioned or discussed in Lesson 1: Array.
FORTRAN (1957)
LISP (1958)
COBOL (1960)
ALGOL 60(1960)
C (1972)
C++ (1983)
By using strcmp(s1, s2), what is the output if the value of s1 and s2 are the same?
0
What is the general form to initialize values to one-dimensional array in C++?
data_type array_name[array_size] = {comma_separated_element_list};
Dr. _____ wrote the first array – sorting program (merge sort) in 1945, during the building of the first stored-program computer.
Jon Von Neumann
What is the purpose of strcpy(s1,s2);?
Copies string s2 into string s1.
What are the two (2) statements that can be used to determine the partial or the complete flow in programs?
IF STATEMENTS
SWITCH CASE STATEMENTS
By using strcmp(s1, s2), what is the output if the value of s1 is greater than s2?
1
What is the purpose of strcmp(s1, s2);?
Returns 0 if s1 and s2 are the same; less than 0 if s1<s2; greater than 0 if s1>s2.
ADVANTAGES OF ARRAY
Less code is required, one variable can store numbers of value.
Code Optimization
What is the general form to declare string in C++?
char string_name[string_size];
or
string string_name[string_size];
ADVANTAGES OF ARRAY
With the help of array index you can randomly access any elements from the array.
Random Access
By using strcmp(s1, s2), what is the output if the value of s1 is lesser than s2?
-1
What is the reason why null character '\0' is optional?
The C++ compiler automatically places the ‘\0’ (null character) at the end of the string when it initializes the array.