ou have to answer all subparts. Please do if not

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

You have to answer all subparts. Please do if not 

1.
(a) Given a flowchart below:
Diberikan carta alir di bawah:
Start
read x
Yes
result false +
print "x must
be greater
than 3 "
No
Yes
x % 2 = 0?
x <= 3 ?
No
i= 3
divider sqrt(x)
result = true
No
i<= divider ?+
Yes
x % i =0?
No
•ii+2
Yes
print result
result false
stop
(i)
Write a C++ program for the above flowchart.
Tulis atur cara C++ bagi carta alir di atas.
(ii) What will be printed out if the value of x is
Apakah yang akan dicetak jika nilai x adalah
(A) 37
(B) 54
(C) 2
Transcribed Image Text:1. (a) Given a flowchart below: Diberikan carta alir di bawah: Start read x Yes result false + print "x must be greater than 3 " No Yes x % 2 = 0? x <= 3 ? No i= 3 divider sqrt(x) result = true No i<= divider ?+ Yes x % i =0? No •ii+2 Yes print result result false stop (i) Write a C++ program for the above flowchart. Tulis atur cara C++ bagi carta alir di atas. (ii) What will be printed out if the value of x is Apakah yang akan dicetak jika nilai x adalah (A) 37 (B) 54 (C) 2
CPT111
-3-
(ii) What is the objective of the above program?
Apakah objektif atur cara di atas?
(50/100)
(b) Write the switch statement equivalent to the following set of C++ code.
Assume x has already been declared to be of the int data type.
Tulis kenyataan switch yang berpadanan dengan set kod C++ berikut.
Anggapkan x telah diisytiharkan sebagai jenis data int.
if ((x- 1)1 (x 2))
cout << " need to take LMT100 " << endl;
else if ( (x 3) II (x 4))
cout << " register LSP300 "<< endl:
else if (x 5)
cout <<"no need to register any English course" << endl:
else
cout << " wrong value of x "<< endl:
(20/100)
(c) Write a program segment using for loop to produce the following table.
Tulis satu keratan atur cara menggunakan gelung for bagi menghasilkan
jadual seperti berikut.
+]
2.
3.
1.
2.
3
1.
1
3
4.
3.
3
4.
(30/100)
Transcribed Image Text:CPT111 -3- (ii) What is the objective of the above program? Apakah objektif atur cara di atas? (50/100) (b) Write the switch statement equivalent to the following set of C++ code. Assume x has already been declared to be of the int data type. Tulis kenyataan switch yang berpadanan dengan set kod C++ berikut. Anggapkan x telah diisytiharkan sebagai jenis data int. if ((x- 1)1 (x 2)) cout << " need to take LMT100 " << endl; else if ( (x 3) II (x 4)) cout << " register LSP300 "<< endl: else if (x 5) cout <<"no need to register any English course" << endl: else cout << " wrong value of x "<< endl: (20/100) (c) Write a program segment using for loop to produce the following table. Tulis satu keratan atur cara menggunakan gelung for bagi menghasilkan jadual seperti berikut. +] 2. 3. 1. 2. 3 1. 1 3 4. 3. 3 4. (30/100)
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY