Independent assessment A: parcel dispatch
סדנת ביקורים עצמאית
אלו הן שאלות מקוריות ומתוקנות בסגנון בוחני AS 9618. הזמן המומלץ הוא 35 דקות. קרא כל חלק לפני מענה. שלח את כל התשובות יחד; הפותר והתמיכה יהיו לא זמינים עד אז.
בדיקות מבניות מעניק 2 נקודות לעקיבה, 2 לבדיקות גבול, ו6 לכל אלגוריתם מלא. חלק תכנותי זוכה בנקודות רק כאשר כל המקרים עוברים בהצלחה. מדד אימון זה אינו כרוך בתוך סכמת ציון של קמברידג'
תיבת ההסבר: הסבר את בחירת לולאתך, את המצב החייב להישמר במקרה של דחייה, ואת מטרת כל פרמטר. לאחר השליחה, השווה לתשובות המופת. מורה אמור לבדוק הסברים ולהעניק נקודות חלקיות לבוחן; בדיקות אוטומטיות אינן יכולות לעשות זאת.
Available begins at 24. Process requests [12, 0, 12, 25]: accept positive requests no larger than Available and subtract accepted amounts. Give Available after EACH request.
Valid quantities for an unchanged stock of 6 are 1 to 6 inclusive. Give FOUR boundary values in ascending order, including the immediately invalid values.
For parcel dispatch, read non-negative Available, then NumberOfRequests (1 to 8), then NumberOfRequests integer requests. Accept a request only if positive and no greater than current Available. Output ok/no for every request, then final Available. Refused requests must not change it.
המשוב מופיע לאחר ההגשה.
Write only FUNCTION CountLong(FileName : STRING, Limit : INTEGER) RETURNS INTEGER. Read the supplied text file, return how many lines have length at least Limit, and close it. The file may be empty.
המשוב מופיע לאחר ההגשה.
Explain your choice of data structure and loop. Identify one boundary case and predict its result. For a subroutine, explain what is returned or changed in the caller.
נשמר להצעה זו בדפדפן זה. עיין בעצמך או עם המורה; הסברים אלו אינם מסומנים אוטומטית.
עיין בהסבר שלך לפי הקריטריונים הבאים
- My types and data structure match the data and the question.
- I justified the loop and checked its first and last iterations.
- Initial values and rejected operations preserve the intended state.
- My test includes input, purpose and expected result.
- I distinguished returning a value from printing and changing caller state.
זמן מומלץ: 35 דקות. ענו על כל חלק לפני השליחה. הרצה, בדיקה וחשפים יעוכבו עד השליחה. לאחר מכן התשובות ינעלו לבדיקה.