Deck 4: Networking and the Internet

ملء الشاشة (f)
exit full mode
سؤال
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
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
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
سؤال
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 is not a means of repeating a block of instructions?

A) Pretest loop
B) Posttest loop
C) Recursion
D) Assignment statement
سؤال
In general, an algorithm in which of the following categories is considered more efficient?

A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )
سؤال
Which of the following does not print the same sequence of numbers as the others?

A) X \leftarrow 5
B) X \leftarrow 4
C) X \leftarrow 5
 <strong>Which of the following does not print the same sequence of numbers as the others?</strong> A) X  \leftarrow  5 B) X  \leftarrow  4 C) X  \leftarrow  5   <div style=padding-top: 35px>
سؤال
Which of the following is not a way of representing algorithms?

A) Stepwise refinement
B) Pseudocode
C) Flowchart
D) Programming language
سؤال
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
سؤال
Which of the following set of instructions defines an algorithm in the formal, strict sense? Which of the following set of instructions defines an algorithm in the formal, strict sense?  <div style=padding-top: 35px>
سؤال
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
سؤال
The binary search algorithm is an example of an algorithm in which of the following classes?

A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )
سؤال
Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  <strong>Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  </strong> A) X > 5 B) X < 8 C) X  \ge  5 D) X  \le  6 <div style=padding-top: 35px>

A) X > 5
B) X < 8
C) X \ge 5
D) X \le 6
سؤال
Preconditions, postconditions, and loop invariants are examples of which of the following?

A) Pseudocode
B) Iterative structures
C) Assertions
D) Recursion
سؤال
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
سؤال
Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  <strong>Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  </strong> A) X > 5 B) X < 5 C) X  \ge   5 D) X  \le  5 <div style=padding-top: 35px>

A) X > 5
B) X < 5
C) X \ge 5
D) X \le 5
سؤال
Which of the following is an activity?

A) Algorithm
B) Program
C) Process
سؤال
The insertion sort algorithm is an example of an algorithm in which of the following classes?

A) Θ \varTheta (lg n)
B) F Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )
سؤال
Which of the following is the base case in the recursive procedure below? <strong>Which of the following is the base case in the recursive procedure below?  </strong> A) N > 0 B) N = 0 C) N < 0 <div style=padding-top: 35px>

A) N > 0
B) N = 0
C) N < 0
سؤال
Which of the following lists would not be obtained at some point when applying the insertion sort algorithm to the list below? Which of the following lists would not be obtained at some point when applying the insertion sort algorithm to the list below?  <div style=padding-top: 35px>
سؤال
Which of the following is a representation?

A) Algorithm
B) Program
C) Process
سؤال
The pseudocode used in this chapter included both an if-then statement and an if-then-else statement.
Show how the statement 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.<div style=padding-top: 35px> can be simulated with a program segment using only if-then statements.
سؤال
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. 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.  <div style=padding-top: 35px>
سؤال
Identify a flaw in the control of the following loop. Identify a flaw in the control of the following loop.  <div style=padding-top: 35px>
سؤال
List three of the primitives in the pseudocode developed in this chapter.
____________________
____________________
____________________
سؤال
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.) 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.)  <div style=padding-top: 35px>
سؤال
Use a repeat loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure. Use a repeat loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure.  <div style=padding-top: 35px>
سؤال
Identify a loop invariant associated with the point in the loop below at which a test for termination is performed. Identify a loop invariant associated with the point in the loop below at which a test for termination is performed.   ___________________<div style=padding-top: 35px> ___________________
سؤال
Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure. Use a while loop structure to produce a non-recursive program segment that prints the same sequence of numbers as the following recursive procedure.  <div style=padding-top: 35px>
سؤال
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.
سؤال
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. 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.  <div style=padding-top: 35px>
سؤال
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?
_______________
سؤال
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?
_______________
سؤال
Rewrite the following routine using a pretest while statement. Rewrite the following routine using a pretest while statement.  <div style=padding-top: 35px>
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/33
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
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
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
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
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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
5
In general, an algorithm in which of the following categories is considered more efficient?

A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
6
Which of the following does not print the same sequence of numbers as the others?

A) X \leftarrow 5
B) X \leftarrow 4
C) X \leftarrow 5
 <strong>Which of the following does not print the same sequence of numbers as the others?</strong> A) X  \leftarrow  5 B) X  \leftarrow  4 C) X  \leftarrow  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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
9
Which of the following set of instructions defines an algorithm in the formal, strict sense? 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
11
The binary search algorithm is an example of an algorithm in which of the following classes?

A) Θ \varTheta (lg n)
B) Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( 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?  <strong>Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  </strong> A) X > 5 B) X < 8 C) X  \ge  5 D) X  \le  6

A) X > 5
B) X < 8
C) X \ge 5
D) X \le 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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?  <strong>Which of the following is a loop invariant at the point at which the test for termination is performed in the following loop structure?  </strong> A) X > 5 B) X < 5 C) X  \ge   5 D) X  \le  5

A) X > 5
B) X < 5
C) X \ge 5
D) X \le 5
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
16
Which of the following is an activity?

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) Θ \varTheta (lg n)
B) F Θ \varTheta (n)
C) Θ \varTheta (n lg n)
D) Θ \varTheta ( n2 )
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
18
Which of the following is the base case in the recursive procedure below? <strong>Which of the following is the base case in the recursive procedure below?  </strong> 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? 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
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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 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. can be simulated with a program segment using only if-then statements.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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. 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. 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.) 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. 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. 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. 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.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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. 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?
_______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 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?
_______________
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
33
Rewrite the following routine using a pretest while statement. Rewrite the following routine using a pretest while statement.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 33 في هذه المجموعة.