![]() This expression will have a value of 0 for lists for which LENGTH (list) is 0, i.e. The expression LENGTH (list) MOD 2 finds the remainder when the number of items on the list is divided by 2. Based on the code below, what would be the best phrase to replace missing output?Ī)You have more than two items in your list!ī)You have an odd amount of items in your list!ĭ)You have an even amount of items in your list! d)You have an even amount of items in your list! ![]() Now the variable LN holds the first name, and FN holds the last name, so these two will be printed in the correct order. To complete the swap, FN is set to the value of Temp. At this point, LN and FN are both set to first name (the original value of FN), while Temp holds the last name value (the original value of FN). Then the value of LN is changed to be the current value of FN. First the value of the variable Temp is set to the current value of LN. Which of the following code segments, inserted in the correct place in the procedure will cause the program to print the name tags in the desired way? The procedure for printing the name tags uses the variables FN for the first name and LN for last name. Unfortunately for each guest it prints the last name before the first name when the opposite is desired. A program is used to print name tags for guests at an event. This algorithm is commonly called a selection sort as each time the minimum value is "selected" from the remaining list and moved to the top. An algorithm finds the minimum value in the list and swaps it with the value in the first position, then repeats these steps for the remainder of the list, swapping with the second position, then the third position and so forth. Sometimes we care about the order of a list, and need to reorder the items according to a condition (alphabetical, numerical, etc). Therefore with this code the program will set each grade 5 points higher if that does not give a result greater than 100, and set it to 100 otherwise. If it is, then the code in the IF block will run, setting the value of the grade to 100. For each grade, this code will initially increase its value by 5, before using an IF statement with a condition checking if the modified grade is greater than 100. The statement min (gradeList + 5, 100) returns gradeList + 5 if this is smaller than 100, and 100 otherwise since it returns the minimum of the two expressions. For each person in citzlist a)gradeList ← min (gradeList + 5, 100) The code makes use of the functions GetAgeOf and GetNameOf, which are used to retrieve the age and name of a citizen from a record which is inputted. Given below is a segment of pseudocode that should find the record of every citizen over the age of 50 in the county. The county clerk's office is writing a program to search their database for citizen records based on information about that citizen such as first name, last name, age, etc.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |