1.
Phát biểu nào dưới đây về kiểu mảng là phù hợp?
Correct Answer
C. Là một dãy hữu hạn các phần tử cùng kiểu;
Explanation
The statement "Là một dãy hữu hạn các phần tử cùng kiểu" is the correct answer because it accurately describes an array. An array is a finite sequence of elements of the same type. The other statements in the question do not fully define an array. The fact that an array can contain a set of integers or have a maximum length of 255 does not encompass the complete definition of an array. Additionally, the statement that an array cannot contain characters is incorrect, as arrays can hold elements of any type, including characters.
2.
Hãy chọn phương án ghép đúng nhất. Để khai báo số phần tử của mảng trong PASCAL, người lập trình cần:
Correct Answer
B. Khai báo chỉ số bắt đầu và kết thúc của mảng;
Explanation
To declare the number of elements in a Pascal array, the programmer needs to declare the starting and ending indices of the array. This is because in Pascal, arrays are declared with a specific range of indices, and the number of elements in the array is determined by the difference between the starting and ending indices, plus one. Therefore, declaring the starting and ending indices of the array is necessary to determine the size of the array.
3.
Phát biểu nào dưới đây về chỉ số của mảng là phù hợp nhất?
Correct Answer
A. Dùng để truy cập đến một phần tử bất kì trong mảng;
Explanation
This statement is the most appropriate explanation because it accurately describes the purpose of an index in an array. An index is used to access any element in an array, allowing for easy retrieval and manipulation of specific elements. The other statements mention managing the size of the array and using it in loops, but they do not specifically address the purpose of an index.
4.
Phương án nào dưới đây là khai báo mảng hợp lệ?
Correct Answer
A. Mang : ARRAY[0..10] OF INTEGER;
Explanation
The correct answer is "mang : ARRAY[0..10] OF INTEGER;". This is the correct declaration of an array in Pascal, where "mang" is the name of the array, "[0..10]" represents the range of indices for the array (from 0 to 10), and "INTEGER" specifies the type of data that the array will store.
5.
Which one do you like?
Correct Answer
C. For k := 16 downto 0 do write(a[k]);
Explanation
The correct answer is "for k := 16 downto 0 do write(a[k]);". This answer is correct because it uses the correct syntax for a loop that iterates from 16 down to 0. The keyword "downto" is used to specify the direction of the loop, and the variable "k" is initialized to 16 and decremented by 1 with each iteration. The statement "write(a[k]);" is used to output the value of the array element at index k.
6.
Cho khai báo mảng như sau: VAR m: ARRAY[0..10] of Integer;Phương án nào dưới đây chỉ phần tử thứ 10 của mảng?
Correct Answer
C. A[9]
Explanation
The correct answer is a[9] because arrays in most programming languages are zero-indexed, which means the first element of the array is at index 0. Therefore, the tenth element of the array would be at index 9.
7.
Hãy chọn phương án ghép đúng. Độ dài tối đa của xâu kí tự trong PASCAL là:
Correct Answer
B. 255
Explanation
The correct answer is 255. In Pascal, the maximum length of a string is determined by the size of the string type declaration. In Pascal, a string is declared with a fixed size, and the maximum size is 255 characters. Therefore, the maximum length of a string in Pascal is 255 characters.
8.
Hãy chọn phương án ghép đúng. Cho xâu S là ‘Hanoi-Vietnam’. Kết quả của hàm Length(S) là:
Correct Answer
B. 13
Explanation
The correct answer is 13 because the function Length(S) returns the number of characters in the string S. The string "Hanoi-Vietnam" has a length of 13 characters, including the hyphen.
9.
Hãy chọn phương án ghép đúng. Cho xâu S là ‘Hanoi-Vietnam’. Kết quả của hàm Pos(‘Vietnam’,S)là:
Correct Answer
C. 7
Explanation
The function Pos('Vietnam', S) returns the position of the first occurrence of the string 'Vietnam' within the string S. In this case, the string S is 'Hanoi-Vietnam'. The function will search for the string 'Vietnam' within S and return the position of its first occurrence. Since 'Vietnam' starts at the 7th position in 'Hanoi-Vietnam', the correct answer is 7.
10.
Cho khai báo sau: VAR st: STRING;Phát biểu nào sau đây là đúng?
Correct Answer
C. Xâu có độ dài lớn nhất là 255;
Explanation
The correct answer is "Xâu có độ dài lớn nhất là 255" because it states that the maximum length of the string is 255 characters. This means that any string declared using the variable "st" can have a maximum length of 255 characters.
11.
Hãy chọn phương án ghép đúng nhất. Thủ tục chuẩn Insert(S1,S2,vt) thực hiện
Correct Answer
A. Chèn xâu S1 vào S2 bắt đầu từ vị trí vt
Explanation
The correct answer is "chèn xâu S1 vào S2 bắt đầu từ vị trí vt". This is because the procedure "Insert(S1,S2,vt)" is used to insert string S1 into string S2 starting from position vt.
12.
Đoạn chương trình sau in ra kết quả nào?Program Welcome ;Var a : string[10];Begin a := ‘tinhoc’; writeln(length(a));End.
Correct Answer
A. 6
Explanation
The program initializes a variable "a" with the value "tinhoc" and then uses the "length" function to determine the length of the string. The length of the string "tinhoc" is 6 characters, so the program will output 6.
13.
Cho str là một xâu kí tự, đoạn chương trình sau thực hiện công việc gì? for i := length(str) downto 1 do write(str[i]) ;
Correct Answer
D. In từng kí tự ra màn hình theo thứ tự ngược;
Explanation
The given code snippet iterates through the characters of the string "str" in reverse order, starting from the last character and going up to the first character. It then prints each character to the screen. Therefore, the code will output each character of the string in reverse order.
14.
Phát biểu nào sau đây là đúng?
Correct Answer
B. Mảng một chiều là một dãy hữu hạn các phần tử cùng kiểu dữ liệu.
Explanation
The correct answer is "Mảng một chiều là một dãy hữu hạn các phần tử cùng kiểu dữ liệu." This statement is correct because an array is a finite sequence of elements that are of the same data type. In an array, all elements must have the same data type, whether it is integers, characters, or any other standard data type. This ensures that the elements in the array can be accessed and manipulated consistently.
15.
Phát biểu nào sau đây là sai?
Correct Answer
B. Với khai báo xây dựng kiểu mảng một chiều, không thể biết được mảng chứa tối đa bao nhiêu phần tử.
Explanation
The statement "Với khai báo xây dựng kiểu mảng một chiều, không thể biết được mảng chứa tối đa bao nhiêu phần tử" is correct because when declaring and constructing a one-dimensional array, we do not specify the maximum number of elements that the array can contain. The size of the array can be determined dynamically at runtime based on the program's needs. Therefore, it is not possible to know the maximum number of elements that the array can hold beforehand.
16.
Phát biểu nào dưới đây là sai?
Correct Answer
D. Các phép toán thao tác với xâu tương tự như các phép toán thao tác với mảng.
Explanation
The statement is correct. It states that the operations performed on strings are similar to the operations performed on arrays. This means that strings can be accessed, modified, and manipulated in a similar way to arrays.
17.
Biểu thức quan hệ nào dưới đây cho giá trị TRUE?
Correct Answer
D. 'MOOR' < 'MOORK'
Explanation
The answer is 'MOOR' < 'MOORK' because in lexicographic order, 'MOOR' comes before 'MOORK'. In this order, the comparison is made character by character from left to right, and 'R' is less than 'K', so 'MOOR' is considered smaller than 'MOORK'.
18.
Biểu thức quan hệ nào dưới đây cho giá trị FALSE?
Correct Answer
B. 'MOOR' < 'LOOK'
Explanation
The correct answer is 'MOOR' < 'LOOK'. In lexicographic order, 'M' comes after 'L', so 'MOOR' is greater than 'LOOK'. Therefore, the expression 'MOOR' < 'LOOK' evaluates to FALSE.
19.
Trong ngôn ngữ lập trình Pascal, về mặt cú pháp câu lệnh nào sau đây là đúng?
Correct Answer
D. Type mang1c=array[1..100] of char;
Explanation
The correct answer is "Type mang1c=array[1..100] of char;" because it follows the correct syntax for declaring an array in Pascal. The keyword "Type" is used to declare a new type, followed by the name of the type (in this case "mang1c"), the keyword "array", the range of indices (in this case "1..100"), and the type of elements in the array (in this case "char").
20.
Hãy chọn phương án hợp lý nhất. Trong ngôn ngữ lập trình Pascal
Correct Answer
A. Các phần tử của mảng một chiều được sắp thứ tự theo chỉ số;
Explanation
The correct answer states that in the Pascal programming language, the elements of a one-dimensional array are sorted according to their index. This means that the elements are arranged in the order of their position within the array, starting from index 0 and increasing sequentially. The other options mention sorting the elements based on their values, either in descending or ascending order, but this is not the case in Pascal. Therefore, the correct answer is that the elements of a one-dimensional array in Pascal are sorted according to their index.