The operation for removing and returning the top element of the stack is traditionally called:
4 phương ánCó giải thích
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Đáp án đúng: "pop". Ngăn xếp có đúng hai phép cơ bản mang tên truyền thống: push đẩy phần tử vào đỉnh, pop lấy phần tử ở đỉnh ra và trả nó về cho người gọi; chính cặp tên đó làm người đọc nhận ra ngay kiểu dữ liệu vào sau ra trước. Vì vậy "peek" sai vì nó chỉ đọc giá trị ở đỉnh mà không tháo phần tử nào, số phần tử sau lệnh vẫn như trước; "delete" sai vì đó là tên chung của phép xoá, không nói gì tới việc trả phần tử về và cũng không gắn với đỉnh ngăn xếp; "remove" sai vì nó là tên quen thuộc của các lớp danh sách và tập hợp, nơi ta xoá theo chỉ số hoặc theo giá trị bất kỳ, chứ không phải tên truyền thống của phép lấy khỏi đỉnh ngăn xếp.
Cùng phần 2
Select the statement that is most correct.
Which of the following applications may not use a stack?Có lời giảiCâu hỏiConsider the following pseudocode:
declare a stack of characters
while(there are more characters in the word to read)
{read a character
if a character is '*' then
pop the stack
else
push the character into the stack
}
while(the stack is not empty)
pop and write the poped character to the screen
What is written to the screen for the input "Good**Morn**in***g" ?Có lời giảiCâu hỏiConsider the following pseudocode:
declare a stack of characters
while(there are more characters in the word to read)
{read a character
if a character is '*' then
pop and write the poped character to the screen
else
push the character into the stack
}
What is written to the screen for the input "Good**Morn**i***ng" ?Có lời giảiCâu hỏiCả 51 câu của chủ đề51 câu
Xuất hiện trong 1 bộ đề
Đi tiếp từ đây