1. Trang chủ
  2. » Giáo án - Bài giảng

nguyên lý ngôn ngữ lập trình nguyễn hứa phùng sequence control sinhvienzone com

6 58 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Nội dung

Sequence Control Return to Assessment List 10.0 Points Part of - 1.0 Points Question of 10 Rewrite the following infix expression using Cambridge Polish prefix format? a+b*c+d+e*f om A (+ a (* b c) d (* e f)) B + + + a * b c d * e f C C (+ (+ (+ a (* b c)) d) (* e f)) ne D (((a + (b * c)) + d) + (e * f)) en Zo E + a * b c d * e f Question of 10 1.0 Points nh a+b*c+d+e*f Vi Rewrite the following infix expression using the Polish postfix format?Assume that all operators have operands Si A a + b c * d + e f * + B a b c * d e f * + + + C a b c * d e f * + D a b + c * d + e f * + E a b c * + d + e f * + 1.0 Points Question of 10 SinhVienZone.com https://fb.com/sinhvienzonevn Rewrite the following infix expression using the Polish prefix format? Assume that every operator has only operands a+ b*c+d+e*f A + a * b c + + d * e f B + a * b c d * e f C + + a * b c + d * e f om D + + + a * b c d * e f C E + a * b c + d * e f ne Question of 10 1.0 Points Zo Select all possible result of the following C expression: a + (a = 2) * a en Assume that variable a contains value before the above expression is evaluated A 10 D Si E nh C Vi B 1.0 Points Question of 10 In some language like ADA, there are two kinds of AND/OR operator: short-circuit (AND THEN) and non-short circuit(AND).Select logical expressions that are required short-circuit evaluation? A (a == 0) || ((b / a) > 5) B (a > 0) && (b > 0) C (a != b) && (a * b > 0) D (a > 0) && (sqrt(a) > 2) //sqrt is the function to calculate the square root of its parameter SinhVienZone.com https://fb.com/sinhvienzonevn E (i < a.length) && (a[i] > 0) 1.0 Points Question of 10 Given the grammar of if statement, select the language that there is NO dangling else problem A → if then else B → if then else endif | if then endif om C → if \n ( \n)+ else \n ( \n)+ | if \n ( \n)+ ne E → if then else | if then C D → if () else | if () Question of 10 1.0 Points en Si nh B switch (x) { 1: command1;break; 20: command2;break; 37: command3;break; } Vi A switch (x) { 20: command1;break; 21 : command2;break; 22 100: command3;break; } Zo which switch statement can be implemented using jump table? C switch (x) { 1: command1;break; 2: command2;break; 3: command3;break; } D switch (x) { 2: command1;break; : command2;break; 6: command3;break; } 1.0 Points Question of 10 SinhVienZone.com https://fb.com/sinhvienzonevn Given the semantics of the for statement: for i = to by as follows, i = loop: if i > goto out i = i + goto loop out: C om How many times does the following for statement iterate? n := 10; j = 1; for i:= to n by j j++; A ne B infinite Zo C 10 1.0 Points Vi Question of 10 en D 15 Si nh Given the following control flow, SinhVienZone.com https://fb.com/sinhvienzonevn Select the code that implements the above control flow? A { action if (condition) break action } while (true); B while (true){ action if (! condition) break; action om } C for (action 1;condition;action 1) action ne C D action while (condition) { action action } en } Zo E while (condition) { action action 1.0 Points Vi Question 10 of 10 Si nh Given the following C code, while (i > n) { // line while (j > m) { //line while (k > p) { // line s += k; if (s > 1000) break; // line k ; } j ; //line8 } i ; //line 10 } //line 12 Where does the control come when the break at line is executed? A line B line 10 C line SinhVienZone.com https://fb.com/sinhvienzonevn D line Si nh Vi en Zo ne C om E line 12 SinhVienZone.com https://fb.com/sinhvienzonevn ... 1: command1;break; 2: command2;break; 3: command3;break; } D switch (x) { 2: command1;break; : command2;break; 6: command3;break; } 1.0 Points Question of 10 SinhVienZone. com https://fb .com/ sinhvienzonevn... the control come when the break at line is executed? A line B line 10 C line SinhVienZone. com https://fb .com/ sinhvienzonevn D line Si nh Vi en Zo ne C om E line 12 SinhVienZone. com https://fb .com/ sinhvienzonevn... Question of 10 en D 15 Si nh Given the following control flow, SinhVienZone. com https://fb .com/ sinhvienzonevn Select the code that implements the above control flow? A { action if (condition) break

Ngày đăng: 30/01/2020, 22:17

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN