1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Soft Desigh and Development Engineer Examintion(Afternoon, part 2) ppsx

25 268 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Nội dung

MINISTRY OF SCIENCE AND TECHNOLOGY HOÀ LC HIGH TECH PARK MANAGEMENT BOARD VIETNAM IT EXAMINATION AND TRAINING SUPPORT CENTER (VITEC) SOFTWARE DESIGN AND DEVELOPMENT ENGINEER EXAMINATION 26 th January 2003 Afternoon I I Do not open the exam booklet until instructed to do so. Inquiries about the exam questions will not be answered. B KHOA HC VÀ CÔNG NGH BAN QUN LÝ KHU CÔNG NGH CAO HOÀ LC TRUNG TÂM SÁT HCH CÔNG NGH THÔNG TIN VÀ H TR ÀO TO (VITEC) SÁT HCH K S THIT K VÀ PHÁT TRIN PHN MM Ngày 26 tháng 1 nm 2003 Phn thi bui chiu I I Không m đ thi trc khi đc phép. Các thc mc v câu hi thi s không đc tr li 2003 VITEC Software Design and Development Engineer Examination (Afternoon, Part 2) Questions must be answered in accordance with the following: Question Nos. Q1 Question Selection All Sub-Questions are compulsory Examination Time 15:30-16:30 (60 minutes) Instructions: 1. Use an HB pencil. If you need to change an answer, erase your previous answer completely and neatly. Wipe away any eraser debris. 2. Mark your examinee information and test answers in accordance with the instructions below. Your test will not be graded if you do not mark properly. Do not mark or write on the answer sheet outside of the prescribed places. (1) Examinee Number Write your examinee number in the space provided, and mark the appropriate space below each digit. (2) Date of Birth Write your date of birth (in numbers) exactly as it is printed on your examination admission card, and mark the appropriate space below each digit. (3) Write each answer in the space specified for that question. Answer can be written in English or Vietnamese. (4) Write your answers clearly and neatly. Answers that are difficult to read will receive a lower score. 3. After the test, you may take this question booklet home with you. Do not open the exam booklet until instructed to do so. Inquiries about the exam questions will not be answered. 2003 VITEC Class II Information Technology Engineer Examination - Afternoon Sát hch K s Thit k và Phát trin phn mm (Bui chiu - Phn 2) Các câu hi phi đc tr li tuân theo điu sau: S hiu câu hi Q1 Câu hi la chn Tt c các câu hi con đu bt buc Thi gian sát hch 15:30 ~ 16:30 (120 phút) Hng dn: 1. Dùng bút chì HB. Nu bn cn đi câu tr li, hãy xoá ht câu tr li trc. Phi sch bi ty trên giy. 2. ánh du thông tin sát hch và câu tr li sát hch ca bn theo hng dn di đây. Bài sát hch ca bn s không đc chm nu bn không đánh du đúng. ng đánh du hay vit lên t giy tr li bên ngoài ch đã qui đnh. (1) S hiu thí sinh Hãy vit s hiu thí sinh  ch đã cho, và đánh du vào ch thích hp di mi ch s. (2) Ngày sinh Hãy vit ngày sinh ca bn (theo s) đích xác nh nó đc in trong phiu d thi, và đánh du vào ch thích hp di mi ch s. (3) Hãy vit câu tr li ti v trí đc dành cho câu hi đó. Câu tr li có th vit bng ting Anh hoc ting Vit. (4) Hãy tr li mt cách rõ ràng và gãy gn. Nhng câu tr li khó đc s b đim thp. 3. Cui gi thi, bn có th gi li b đ thi này. Không m tp giy thi chng nào cha đc hng dn làm nh vy. Mi vic hi thêm v các câu hi sát hch s không đc tr li. 2003 VITEC Class II Information Technology Engineer Examination - Afternoon Sát hch K s Thit k và Phát trin phn mm (Bui chiu - Phn 2) Các câu hi phi đc tr li tuân theo điu sau: S hiu câu hi Q1 Câu hi la chn Tt c các câu hi con đu bt buc Thi gian sát hch 15:30 ~ 16:30 (120 phút) Hng dn: 1. Dùng bút chì HB. Nu bn cn đi câu tr li, hãy xoá ht câu tr li trc. Phi sch bi ty trên giy. 2. ánh du thông tin sát hch và câu tr li sát hch ca bn theo hng dn di đây. Bài sát hch ca bn s không đc chm nu bn không đánh du đúng. ng đánh du hay vit lên t giy tr li bên ngoài ch đã qui đnh. (1) S hiu thí sinh Hãy vit s hiu thí sinh  ch đã cho, và đánh du vào ch thích hp di mi ch s. (2) Ngày sinh Hãy vit ngày sinh ca bn (theo s) đích xác nh nó đc in trong phiu d thi, và đánh du vào ch thích hp di mi ch s. (3) Hãy vit câu tr li ti v trí đc dành cho câu hi đó. Câu tr li có th vit bng ting Anh hoc ting Vit. (4) Hãy tr li mt cách rõ ràng và gãy gn. Nhng câu tr li khó đc s b đim thp. 3. Cui gi thi, bn có th gi li b đ thi này. Không m tp giy thi chng nào cha đc hng dn làm nh vy. Mi vic hi thêm v các câu hi sát hch s không đc tr li. 2003 VITEC Software Design and Development Engineer Examination (Afternoon, Part 2) Questions must be answered in accordance with the following: Question Nos. Q1 Question Selection All Sub-Questions are compulsory Examination Time 15:30-16:30 (60 minutes) Instructions: 1. Use an HB pencil. If you need to change an answer, erase your previous answer completely and neatly. Wipe away any eraser debris. 2. Mark your examinee information and test answers in accordance with the instructions below. Your test will not be graded if you do not mark properly. Do not mark on white on the answer sheet outside of the prescribed places. (1) Examinee Number Write your examinee number in the space provided, and mark the appropriate space below each digit. (2) Date of Birth Write your date of birth (in numbers) exactly as it is printed on your examination admission card, and mark the appropriate space below each digit. (3) Write each answer in the space specified for that question. (4) Write your answers clearly and neatly. Answers that are difficult to read will receive a lower score. 3. After the test, you may take this question booklet home with you. Do not open the exam booklet until instructed to do so. In q uiries about the exam q uestions will not be answered. 1 Q1. Read the following text regarding the creation of a game program, then answer Sub- Questions 1 through 4. A decision was made to create a number guessing game program in which a person (hereinafter referred to as the “player”) competes with a computer. The rules of the game are as follows. (1) The competitors (player and program) each select a four-digit number consisting of four different numerals. In this example, this four-digit number is called the correct answer. The first digit in the correct answer (most significant digit) may be 0. (2) Competitors take turns trying to guess each other’s correct answer, and the first one to guess correctly wins. If both competitors guess correctly in the same number of tries, then they tie. (3) When a competitor receives the other competitor’s guess, it is compared with the receiving competitor’s own correct answer, and a response is sent to the other competitor consisting of the number of hits, hit, or numerals which are correct in both numerical value and digit position; as well as the number of misses, miss, or numerals which are contained in the correct answer, but have incorrect digit positions. For example, if the correct answer is 1357 and the other competitor guesses 5310, then the response consists of one hit (hit) and two misses (miss). An overview of the number guessing game program is presented below. 1. The program determines a correct answer using random numbers. 2. The following are repeated until one of the competitors guesses the other’s correct answer. 2-1. Comparison against correct answer The program receives the player’s guess, compares it against the correct answer, and returns the numbers of hits, hit and misses, miss. 2-2. Guessing process 2-2-1. The program determines the next guess based on the hit and miss it has so far received, then sends that guess to the player. 2-2-2. The program receives the hit and miss calculated by the player. Below, the variables defined in the function are local variables, and the function’s arguments are passed by value unless otherwise specified. The array subscripts start at 0, and array elements are designated as 0th, 1st, 2nd, etc. Figure 1 shows the function for determining the correct answer. With this function, numbers 0 through 9 are randomly generated one at a time, and an array tab consisting of ten elements is used to obtain a four-digit number with no duplicate numerals. “random” 2 is a function for randomly generating natural numbers, and “%” is a modulus operator. The array tab is used as follows. ¦ The initial value of all elements is 0.  If the tab[a] value remains at the initial value 0 for a randomly generated single- digit number a, then a is a number appearing for the first time, and 1 is inserted in tab[a]. ¡ If the value of tab[a] is 1, then the value is not changed. function set_answer () int tab [ 10 ] , n, i, a Set all tab elements to 0 n = 0 for ( i = 1 to 4 ) repeat a = random () % 10 until ( tab [ a ] = 0) tab [ a ] = 1 n = a endfor return n endfunction Fig. 1 “set_answer” Function The algorithm for calculating hit and miss will now be considered. First, the similarity of two four-digit numbers x and y is defined as follows, using the hit and miss of the two numbers: similarity ( x, y ) = hit * 10 + miss The set of the similarity values and the (hit, miss) values has a one-to-one correspondence, so the similarity is used within the program instead of the hit and miss. Similarity calculation is used when the player’s guess is compared with the correct answer, and when the program is determining its own guess. This calculation is done frequently, so a highly efficient execution method will now be considered. In order to improve execution efficiency, before similarity is calculated during the game, one of the numbers to be compared is translated into a form called an array expression. In this translation process, if the subject number is d 4 d 3 d 2 d 1 , then i is stored in the d i th element of the array, and 0 is stored in the other elements. Figure 2 shows the 3 function for translating the number y into an array expression. “pos” is an array which comprises ten elements and is called by reference. function make_pos ( y, pos ) int i, m Set all pos elements to 0 for ( i = 1 to 4 ) m = y % 10 y = y / 10 pos [ b ] = i endfor endfunction Fig. 2 “make_pos” Function When the array expression (pos) for the number y is used, similarity ( x, y ) can be determined using the “sim” function in Figure 3. 4 [...]... [Memo] 9 [Memo] 10 2003 VITEC Software Design and Development Engineer Examination (Afternoon, Part 2) Questions must be answered in accordance with the following: Question Nos Q1 Question Selection All Sub-Questions are compulsory Examination Time 15:30-16:30 (60 minutes) Instructions: 1 Use an HB pencil If you need to change an answer, erase your previous answer completely and neatly Wipe away any eraser... answer candidates; guess[i-1] is the array expression for the ith guess; and log[i-1] is the similarity value between the ith guess and the correct answer “index” is a subscript specifying a position before which the correct answer does not exist in the “nums” elements The initial value for “index” is –1 function make_guess(k) int j index = index + 1 for() // Infinite loop j = 0 while(j < k – 1 and sim(nums[index],... eraser debris 2 Mark your examinee information and test answers in accordance with the instructions below Your test will not be graded if you do not mark properly Do not mark on white on the answer sheet outside of the prescribed places (1) Examinee Number Write your examinee number in the space provided, and mark the appropriate space below each digit (2) Date of Birth Write your date of birth (in... generated numbers will necessarily contain the correct answer Therefore, these numbers are generated in advance and inserted in the “nums” array The algorithm for selecting a guess value in order to guess the player’s correct answer is as follows Numbers are taken from “nums” sequentially, and a number which is not inconsistent with the similarity information obtained thus far is used as the next guess... Fig 4 “make_guess” Function 6 When all of the above-mentioned functions are used, the number guessing game program is as shown in Figure 5 “nums”, “guess”, “log” and “index” are global variables int log[M], guess[M][10], nums[N], index // M and N are array sizes main() char r In “nums”, insert all four-digit numbers comprising four different numerals for() // Repeat game play() write “Continue game?... below each digit (2) Date of Birth Write your date of birth (in numbers) exactly as it is printed on your examination admission card, and mark the appropriate space below each digit (3) Write each answer in the space specified for that question (4) Write your answers clearly and neatly Answers that are difficult to read will receive a lower score 3 After the test, you may take this question booklet home... Infinite loop j = 0 while(j < k – 1 and sim(nums[index], guess[j]) = log[j]) e endwhile if(j < k - 1) f else return nums[index] endif endfor endfunction Hình 4 Hàm “make_guess” 6 Khi t t c các hàm nói trên c s d ng, ch ng trình trò ch i oán s “nums”, “guess”, “log” và “index” là các bi n toàn c c c mô t trong hình 5 int log[M], guess[M][10], nums[N], index // M and N are array sizes main() char r In... with the similarity information obtained thus far is used as the next guess For example, consider a case in which the third guess is to be selected Assume that the similarity values of the correct answer and the previous two guesses were as follows: First Second Guess 1234 1345 similarity 12 02 In this case, assume that the next number taken from “nums” is 2304 A calculation is performed to determine whether... sau: (1) M i bên u th (ng i ch i và ch ng trình) ch n m t s có 4 ch s , m i ch s u khác nhau Trong ví d này, s 4 ch s này g i là áp án úng Ch s u tiên trong áp án úng (ch s có ngh a nh t) có th b ng 0 (2) Các u th n l t ch i s oán áp án úng c a bên kia, và bên nào oán úng tr c là bên th ng N u c hai u th oán úng sau cùng s l n oán, thì hoà (3) Khi m t u th nh n câu oán c a bên kia, nó so sánh câu oán... th 2, v.v Hình 1 bi u di n hàm dùng xác nh áp án úng V i hàm này, các s t 0 n 9 c sinh ng u nhiên t ng s m i l n, và m t m ng tab ch a 10 ph n t c dùng thu c m t s có 4 ch s không có ch s trùng nhau “random” là hàm dùng sinh ng u nhiên m t s t nhiên, và “%” là phép chia l y ph n d M ng tab c dùng nh sau: 2 ¦ Giá tr kh i t o c a t t c các ph n t b ng 0 N u giá tr tab[a] v n còn là giá tr kh i u 0 cho . MINISTRY OF SCIENCE AND TECHNOLOGY HOÀ LC HIGH TECH PARK MANAGEMENT BOARD VIETNAM IT EXAMINATION AND TRAINING SUPPORT CENTER (VITEC) SOFTWARE DESIGN AND DEVELOPMENT ENGINEER EXAMINATION . mc v câu hi thi s không đc tr li 2003 VITEC Software Design and Development Engineer Examination (Afternoon, Part 2) Questions must be answered in accordance with the following:. sát hch s không đc tr li. 2003 VITEC Software Design and Development Engineer Examination (Afternoon, Part 2) Questions must be answered in accordance with the following:

Ngày đăng: 05/08/2014, 17:22