Deck 4: Networking and the Internet
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
سؤال
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/33
العب
ملء الشاشة (f)
Deck 4: Networking and the Internet
1
Under the assumption that N takes on only integer values, which of the following is the termination condition in the following recursive procedure? procedure xxx (N)
If (N < 5) then (print the value of N)
Else (apply the procedure xxx to the value N - 1)
A) N < 5
B) N > 4
C) N > 5
If (N < 5) then (print the value of N)
Else (apply the procedure xxx to the value N - 1)
A) N < 5
B) N > 4
C) N > 5
A
2
When searching within the list Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
Which of the following entries will be found most quickly using the binary search algorithm?
A) Lewis
B) Pat
C) Tom
Which of the following entries will be found most quickly using the binary search algorithm?
A) Lewis
B) Pat
C) Tom
B
3
When searching within the list Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
Which of the following entries will be found most quickly using the sequential search algorithm?
A) Lewis
B) Pat
C) Tom
Which of the following entries will be found most quickly using the sequential search algorithm?
A) Lewis
B) Pat
C) Tom
A
4
Which of the following is not a means of repeating a block of instructions?
A) Pretest loop
B) Posttest loop
C) Recursion
D) Assignment statement
A) Pretest loop
B) Posttest loop
C) Recursion
D) Assignment statement
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
5
In general, an algorithm in which of the following categories is considered more efficient?
A) (lg n)
B) (n)
C) (n lg n)
D) ( n2 )
A) (lg n)
B) (n)
C) (n lg n)
D) ( n2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following does not print the same sequence of numbers as the others?
A) X 5
B) X 4
C) X 5
A) X 5
B) X 4
C) X 5

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
7
Which of the following is not a way of representing algorithms?
A) Stepwise refinement
B) Pseudocode
C) Flowchart
D) Programming language
A) Stepwise refinement
B) Pseudocode
C) Flowchart
D) Programming language
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
8
Under the assumption that X takes on only integer values, which of the following is the termination condition for the following loop? while (X < 5) do
( ) . . )
A) X < 5
B) X > 4
C) X < 4
( ) . . )
A) X < 5
B) X > 4
C) X < 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following set of instructions defines an algorithm in the formal, strict sense? 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
10
Under the assumption that N takes on only integer values, which of the following is the termination condition in the following recursive procedure? procedure xxx (N)
If (N < 5) then (apply the procedure xxx to the value N + 1)
Else (print the value of N)
A) N < 5
B) N > 4
C) N < 4
If (N < 5) then (apply the procedure xxx to the value N + 1)
Else (print the value of N)
A) N < 5
B) N > 4
C) N < 4
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
11
The binary search algorithm is an example of an algorithm in which of the following classes?
A) (lg n)
B) (n)
C) (n lg n)
D) ( n2 )
A) (lg n)
B) (n)
C) (n lg n)
D) ( n2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
12
Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure? 
A) X > 5
B) X < 8
C) X 5
D) X 6

A) X > 5
B) X < 8
C) X 5
D) X 6
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
13
Preconditions, postconditions, and loop invariants are examples of which of the following?
A) Pseudocode
B) Iterative structures
C) Assertions
D) Recursion
A) Pseudocode
B) Iterative structures
C) Assertions
D) Recursion
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
14
Under the assumption that X takes on only integer values, which of the following is the termination condition for the following loop? repeat ( . . . )
Until (X < 5)
A) X < 5
B) X > 4
C) X > 5
Until (X < 5)
A) X < 5
B) X > 4
C) X > 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
15
Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure? 
A) X > 5
B) X < 5
C) X 5
D) X 5

A) X > 5
B) X < 5
C) X 5
D) X 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following is an activity?
A) Algorithm
B) Program
C) Process
A) Algorithm
B) Program
C) Process
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
17
The insertion sort algorithm is an example of an algorithm in which of the following classes?
A) (lg n)
B) F (n)
C) (n lg n)
D) ( n2 )
A) (lg n)
B) F (n)
C) (n lg n)
D) ( n2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following is the base case in the recursive procedure below? 
A) N > 0
B) N = 0
C) N < 0

A) N > 0
B) N = 0
C) N < 0
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
19
Which of the following lists would not be obtained at some point when applying the insertion sort algorithm to the list below? 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
20
Which of the following is a representation?
A) Algorithm
B) Program
C) Process
A) Algorithm
B) Program
C) Process
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
21
The pseudocode used in this chapter included both an if-then statement and an if-then-else statement.
Show how the statement
can be simulated with a program segment using only if-then statements.
Show how the statement

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
22
Circle the portion of the program below in which control of the loop is initialized. Draw a rectangle around the portion in which the test for termination is performed. Underline the portion in which the state of the loop is moved toward the termination condition. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
23
Identify a flaw in the control of the following loop. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
24
List three of the primitives in the pseudocode developed in this chapter.
____________________
____________________
____________________
____________________
____________________
____________________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
25
Use a repeat loop rather than a while loop to accomplish the same results as the following program segment. Assume that X will have only integer values. (You may also use an if statement if you like.) 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
26
Use a repeat loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
27
Identify a loop invariant associated with the point in the loop below at which a test for termination is performed.
___________________

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
28
Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
29
Do the following instructions define an algorithm? Explain your answer.
Write down all the positive odd integers.
Select the integer in the middle of the list.
Print the even integer that is one less than the selected odd integer.
Write down all the positive odd integers.
Select the integer in the middle of the list.
Print the even integer that is one less than the selected odd integer.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
30
Fill in the blank in the procedure below so that the procedure prints the integers from 0 up to the integer value it was given for N. That is, if the procedure is executed with the value of N being 3, it should print 0, 1, 2, 3. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
31
Which of the sequential or binary search algorithms would find the name Roger in the list
John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
more quickly?
_______________
John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
more quickly?
_______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
32
Which of the sequential or binary search algorithms would find the name Kelly in the list
John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
more quickly?
_______________
John, Kelly, Lewis, Maurice, Nathan, Oliver, Pat, Quincy, Roger, Stan, Tom
more quickly?
_______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
33
Rewrite the following routine using a pretest while statement. 

فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck