Vous êtes sur la page 1sur 7

Final Exam Question 1 Marks: 1 Which of the following is not C's characteristic? Choose one answer. a. high-level b.

portable c. low-level d. structured Question 2 Marks: 1 The language from which C was based from. Choose one answer. a. A b. B c. BCPL d. CPL Question 3 Marks: 1 Symbol that denotes the start of a function. Choose one answer. a. # b. ; c. { d. < Question 4 Marks: 1 Statements in a C program ends with this symbol. Choose one answer. a. # b. { c. ; d. < Question 5 Marks: 1 Whic of the following header file is used to open the printf function? Choose one answer. a. string.h b. math.h c. stdio.h d. conio.h Question 6 Marks: 1 What kind of language is C? Choose one answer. a. middle-level b. machine-level c. high-level d. low-level Question 7 Marks: 1 What generation of language was C from? Choose one answer. a. 4GL b. 3GL c. 2GL d. 1GL Question 8 Marks: 1 Symbol that denotes the start of a comment in C. Choose one answer. a. /+ b. /c. /* d. \ Question 9 Marks: 1 Which escape sequence is used to produce a new line within the output screen? Choose one answer. a. /l b. /n c. /t d. /a Question 10 Marks: 1 The extension name for every C program we create. Choose one answer. a. .CPP b. .CL c. .C d. .CC

Question 11 High level languages are ____________. Choose one answer. a. machine independent b. complex c. uses binary codes d. low-level languages Question 12 Marks: 1 Which of the following is not a basic data type in C language? Choose one answer. a. int b. float c. char d. string Question 13 Marks: 1 Which of the following is not part of C language programming process? Choose one answer. a. compile b. edit c. link d. display Question 14 Marks: 1 Which of the following "hot keys" is used to run a C program. Choose one answer. a. CTRL F9 b. F9 c. SHFT F9 d. ALT F9 Question 15 Marks: 1 The following are parts of a turbo C environment except: Choose one answer. a. editor b. window screen c. menu d. hot keys Question 16

Marks: 1 Assume that the expression (!(a < b)) evaluates to true. Which of the following relationships must be true? Choose one answer. a. b>a b. b<=a c. a < b d. a<=b Question 17 Marks: 1 The value of the expression (5 + 3) * (4 + 2) is Choose one answer. a. 48 b. 34 c. 19 d. 23 Question 18 Marks: 1 Given: x = 3; y = - 3 - 30 / 3 + (x + 1) * 2; What is the value of y? Choose one answer. a. -5 b. 5 c. -3 d. 3 Question 19 Marks: 1 Which of the following is a valid printf statement for displaying the value of variable X=10 and is an integer? Choose one answer. a. printf(The value is %d, X); b. printf(The value is , X); c. printf(The value is %f, X); d. printf(The value is %c, X);

Question 20

Marks: 1 To declare variables x and z as integers, which would be the correct way? Choose one answer. a. x, z integer b. int x, z; c. integer x, z; d. x,z int; Question 21 Marks: 1 To solve the dangling else problem, the compiler makes the else ______. Choose one answer. a. attach itself to the last if b. attach itself to the nearest if c. attach itself to the nearest condition d. attach itself to the first if Question 22 Marks: 1 x = 0; if (x > 0) num_pos = num_pos + 1; else if (x < 0) num_neg = num_neg + 1; else num_zero = num_zero + 1; with the code above which statement is executed? Choose one answer. a. num_zero = num_zero + 1; b. num_pos = num_pos + 1; c. num_neg = num_neg + 1; d. x = 0;

Question 23 Marks: 1 Given: line no. 1 if (a < b) 2 printf(a is less than b! ); 3 else 4 printf(a is not less than b! ); Suppose that line no. 4 is executed. What can you deduce about the relationship between the variables a and b? Choose one answer. a. a is greater than b b. a is greater than or equal to b c. a is equal to b d. a is less than or equal to b Question 24 Marks: 1 The expression p * q = = 0 is equivalent to which of the following expressions? Choose one answer. a. p * q = 0 b. (p * q)= = 0 c. p * (q = = 0) d. p = = q * 0 Question 25 Marks: 1 Assume that x = 6, y = 2 and z = 20, what is the value of x <= z && x < y? Choose one answer. a. true b. false c. ignored d. undetermined

Question 26

Marks: 1 The English condition: x and y are greater than z could be expressed in which C statement? Choose one answer. a. x > z || y > z b. x || y > z c. x && y > z d. x > z && y > z Question 27 Marks: 1 These operators combine more than one condition. Choose one answer. a. mathematical b. logical c. equality d. relational Question 28 Marks: 1 Given: if ((x > y) || (x < 6)) printf(x is an element of the solution set. ); For which values of x and y will the printf statement be executed? Choose at least one answer. a. when x is 6 and y is 7 b. when x is 8 and y 0 c. when x is 3 and y is 5 d. when y is 8 and x is 0 Question 29 In a flowchart, what symbolizes decision making? Choose one answer. a. hexagon b. diamond c. parallelogram d. rectangle Question 30

Marks: 1 Which data type is applicable to switch-casebreak statement? Choose one answer. a. double b. char c. string d. float Question 31 Marks: 1 What statement is a multi-way conditional statement that generalizes the if-else statement? Choose one answer. a. for b. switch c. while d. do while Question 32 Marks: 1 grade = 80; if (grade < = 60) printf("Failed"); else printf("Passed"); given the above code, the output will be _____. Choose one answer. a. none because grade was not specified b. Passed c. Failed d. 80 Question 33 Marks: 1 The general form of an if statement is if (expr) statement. If expr is false, then statement is executed; otherwise statement is skipped, and control passes to the next statement. Answer: True Question 34 False

Suppose you have the expression expr1 && expr2. If expr1 is false, then the entire expression is false, so expr2 will never be evaluated. Answer: True Question 35 Marks: 1 False

Marks: 1 High level languages are from this generation. Choose one answer. a. 3GL b. 4GL c. 2GL d. 1GL Question 40 Marks: 1 This generation of language is designed to be closer to natural language. Choose one answer. a. 1GL b. 4GL c. 2GL d. 3GL Question 41 Marks: 1 Translates and executes each program statement one line at a time, instead of first producing a complete machine language program, like compilers and assemblers do. Choose one answer. a. compiler b. interpreter

The printf statement is always executed, when the given program segment below: Given: cat_count = 143; dog_count = 208; if (cat_count > dog_count) printf(There are more cats than dogs! ); Answer: True Question 36 Marks: 1 False

Assuming that x = 25.0 and y = 15.0, what is the value of this condition x < y is true. Answer: True False Question 37 Marks: 1 The generation of programming language where programmers use binary code. Choose one answer. a. 4GL b. 2GL c. 1GL d. 3GL Question 38 Marks: 1 From which of these generation of languages was it called "assembly" language? Choose one answer. a. 2GL b. 1GL c. 4GL d. 3GL

c. assembler d. translator Question 42 Marks: 1 C is belongs to this generation of languages. Choose one answer. a. 2GL b. 1GL c. 3GL d. 4GL Question 43 Marks: 1 This generation of languages uses visual or graphical development interface. Choose one answer. a. 1GL b. 2GL c. 3GL d. 5GL Question 44

Question 39

Marks: 1 3GL programming was the most difficult and error-prone. Answer: True False

for ( num = 0; num <= 3; num++ ) printf(%d, num); Choose one answer. a. 0 b. 2 c. 1 d. 3 Question 50 Marks: 1 Compound statements are enclosed within these grouping symbols. Choose one answer. a. b. /* */ c. { } d. < > Question 51 Marks: 1 In the given for loop the value for x will be incremented by what value? for (x = 0; x< 10; x++) Choose one answer. a. 10 b. 0 c. -1 d. 1 Question 52 Marks: 1 The process in which the loop variable is initialized to a starting value, like 1 or 0. Choose one answer. a. initialization b. decrementation c. control variable limit d. incrementation Question 53 Marks: 1

Question 45 Marks: 1 Occurs when the condition will never be met, due to some inherent characteristic of the loop. Choose one answer. a. infinite loop b. sequenced loop c. sentinel controlled loop d. terminated loop Question 46 Marks: 1 Which of the following is not how loops are controlled? Choose one answer. a. counter controlled b. condition controlled c. sentinel controlled d. if controlled Question 47 Marks: 1 A for loop is executed using a ___________. Choose one answer. a. counter b. condition c. sentinel d. if Question 48 Marks: 1 What looping statement can produce a single result even though the condition is tested false? Choose one answer. a. if b. while c. for d. do while Question 49 Marks: 1 What is the last value displayed on the given for loop?

A kind of looping structure where the control variable limit, initialization and incrementation are placed on a single line declaration. Choose one answer. a. for b. do..while c. if d. while Question 54 Marks: 1 Conditions can be joined with an/a ___________ and __________ characters. Choose one answer. a. &&, || b. $$, && c. ##, || d. /*, */ Question 55 Marks: 1 Which of the following statements is VALID? Choose one answer. a. #define pi 3.1416; b. #define pi 3.1416 c. #constant pi 3.1416 d. #define pi = 3.1416; Question 56 Marks: 1 In all looping structure, the codition is always tested first. Answer: True Question 57 Marks: 1 False

expression is false, so expr2 will never be evaluated. Answer: True Question 59 Marks: 1 False

In implementing the for loop, only 2 loop control components are declared; initialization and test the control variable. Answer: True False Question 60 Marks: 1 In a do-while loop the condition is tested later within the loop. Answer: True False

In a for loop the condition is tested first after initializing the control variable. Answer: True Question 58 Marks: 1 False

Suppose you have the expression expr1 && expr2. If expr1 is false, then the entire