Chapter seven review Monther Aldwairi What is the
- Slides: 48
Chapter seven review Monther Aldwairi
• • • • What is the output of: Private Sub cmd. Button_Click() Dim i As Integer, a(1 To 4) As integer Open "DATA. TXT" For Input As #1 For i = 1 To 4 Input #1, a(i) Next i For i = 4 To 1 Step -2 pic. Box. Print a(i); Next i End Sub Contents of DATA. TXT: 1, 3, 5, 7
• Output: • 73
• What is the output of: • Dim a(2 To 9) As Integer, i As Integer, _ k As Integer, sum As Integer • For i = 2 To 9 • a(i) = i • Next i • sum = 0 • For k = 4 To 6 • sum = sum + 10 ^ a(k-2) • Next k • pic. Box. Print sum
• Output: • 11100
• What is the output of: • • • Dim a(-1 to 5) As Single, x As Single Open "DATA. TXT" For Input As #1 Do While Not EOF(1) Input #1, x a(x) = a(x) + 3 Loop Close #1 pic. Box. Cls pic. Box. Print a(0); a(2) Contents of DATA. TXT: 0, 1, 5, 2, 0
• Output: • 63
• • • • Dim a(-2 To 5), b As Integer Dim i As Integer, j As Integer Open "DATA. TXT" For Input As #1 num = 0 For i = 3 To 5 Input #1, a(i) Next i For j = -1 To 1 Input #1, k b = b + a(k) Next j pic. Box. Print b Contents of DATA. TXT: 2, 1, 0, -1, 3, 3
• Output: • 4
• How many comparisons will be made in the first pass of a bubble sort of n items? • Answer: n-1 • How many comparisons will be made in the second pass of a bubble sort of n items? • Answer: n-2 • How many comparisons will be made in all the passes of a bubble sort of n items? • Answer: (n-1)+(n-2)+(n-3) + … +2+1 • = n(n-1)/2
• Given the following array items: • 3, 1, 8, 9, 2, 10 • a) What is the contents of the array after the first pass of using bubble sort? • b) What is the contents of the array after the first comparison in the second pass? • c) How many comparisons will be made to find 2 using sequential search on the original array? • d) How many comparisons will be made to find 2 using sequential search if the array was sorted?
• How many elements are in the array declared by • Dim my. Array(1 To 5, 1 To 5) As Single • How many elements are in the array declared by • Dim my. Array(0 To 3, 1 To 3) As Single
7. 1
3. Stuhldreher Crowley
4. 11
5. 6 2 9 11 3 4
6. 10 12 3 14
13. river(1) river(2) river(3) river(4) river(5) Thames Ohio Amazon Volga Nile river(1) river(2) river(3) river(4) river(5) Ohio Amazon Volga Nile Thames
14. cat(1) cat(2) cat(3) Felix Garfield Morris cat(4) Socks
7. 2
3. Michigan
4. The sum of the first 4 elements is 30
6. South Pacific
7. The total rainfall for the first quarter is 10
12. hue will be unknown in the Sub procedure. Also, in the Print statement in the Sub procedure, tone needs a subscript.
7. 3
1. 200 100
2. Oliver Stan
3. 11 7 Numbers interchanged.
10. 15 comparisons 11. (n - 1) + (n - 2) +. . . + 1 A shorter version of this formula is n*(n 1)/2
7. 5
4. 1. 2. Bogart
5. 4 1 6 5 8 2
13. Private Sub Exchange(a() As Single) Dim col As Integer, temp As Single 'Interchange values of 2 nd and 3 rd row For col = 1 To 10 temp = a(2, col) = a(3, col) = temp Next col End Sub
14. Private Sub Find. Greatest. Value(a() As Single) Dim row As Integer, col As Integer Dim greatest As Single 'Find greatest value in array and the locations where it occurs greatest = a(1, 1) For row = 1 To 3 For col = 1 To 45 If a(row, col) > greatest Then greatest = a(row, col) End If Next col Next row pic. Output. Print "The greatest value is"; greatest pic. Output. Print "It occurs at (row, col): " For row = 1 To 3 For col = 1 To 45 If a(row, col) = greatest Then pic. Output. Print row, col End If Next col Next row End Sub
- Monther aldwairi
- Deadly sins and heavenly virtues
- Chapter review motion part a vocabulary review answer key
- Hình ảnh bộ gõ cơ thể búng tay
- Bổ thể
- Tỉ lệ cơ thể trẻ em
- Chó sói
- Thang điểm glasgow
- Chúa sống lại
- Kể tên các môn thể thao
- Thế nào là hệ số cao nhất
- Các châu lục và đại dương trên thế giới
- Cong thức tính động năng
- Trời xanh đây là của chúng ta thể thơ
- Mật thư tọa độ 5x5
- Làm thế nào để 102-1=99
- độ dài liên kết
- Các châu lục và đại dương trên thế giới
- Thơ thất ngôn tứ tuyệt đường luật
- Quá trình desamine hóa có thể tạo ra
- Một số thể thơ truyền thống
- Cái miệng nó xinh thế chỉ nói điều hay thôi
- Vẽ hình chiếu vuông góc của vật thể sau
- Biện pháp chống mỏi cơ
- đặc điểm cơ thể của người tối cổ
- Giọng cùng tên là
- Vẽ hình chiếu đứng bằng cạnh của vật thể
- Fecboak
- Thẻ vin
- đại từ thay thế
- điện thế nghỉ
- Tư thế ngồi viết
- Diễn thế sinh thái là
- Dot
- Các số nguyên tố là gì
- Tư thế ngồi viết
- Lời thề hippocrates
- Thiếu nhi thế giới liên hoan
- ưu thế lai là gì
- Hổ đẻ mỗi lứa mấy con
- Sự nuôi và dạy con của hổ
- Hệ hô hấp
- Từ ngữ thể hiện lòng nhân hậu
- Thế nào là mạng điện lắp đặt kiểu nổi
- Chapter 6: career readiness
- Ap gov final review
- Nader amin-salehi
- Traditional and systematic review venn diagram