0% found this document useful (0 votes)
28 views15 pages

Sde 44

Math

Uploaded by

kaleeswaran1605
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views15 pages

Sde 44

Math

Uploaded by

kaleeswaran1605
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

UNIVERSITY OF CALICUT

SCHOOL OF DISTANCE EDUCATION

BSc MATHEMATICS

(2011 Admission Onwards)

VI Semester

Elective Course

‘C’ PROGRAMMING FOR


MATHEMATICAL
COMPUTING
QUESTION BANK
Multiple Choice Questions

1. # Define is a

A. Statement. B. preprocessor compiler directive. C. Function statement. D. None.

2. Program Execution in C begins at:

A. opening brace of the main function. B. Closing brace of the main function. Before the main function

D. None.

3. C Programs are written in C:

A. Upper case letters B. Lower case letters C. Strings D.None.

4. Every program statements in C must end with a :

A. semicolon B Brace C.Colon D.None.

5. Which one among the following statements is true?

A. Every C program ends with an END word.

B. main ( ) is where the program stops its execution.

C. A line in a program may have more than one statement.

D. All variables in C must be declared for their types before they are used in the program.

6. Compiler directives such as define and include are:

A. Symbolic Constants B. logical operators C. special instructions D. declaration statements.

7. In C the smallest individual units are called:

A. Trigraphs B. Tokens C. character set D. white space.

8. Increment and decrement operators are:

A. unary operators B. ternary operator C. special operator D.None.

9. The modulus operator % can be used:

A. Only for floating point data B. integer data C. exponential functions D. None.

10 During modulo division , the sign of the result is positive:

A. If both operands are of the same sign B. If both the first and second operand is negative always
C.. If the second operand is negative D. Both A and B above.

11. When the postfix ++ is used in an expression, the variable is:

A. Incremented first and then expression is evaluated using the new value of the variable.

B. The expression is evaluated first using the original value of the variable and then variable is

incremented.

C. The expression is evaluated first using the original value of the variable and then the variable is

Incremented. D. None of the above.

12. The comma operator can be used to:

A. Construct conditional expressions B. link the related expressions together C. manipulate Data at bit

Level.

D. both A and B above..

13. The sizeof operator is a;

A. Relational operator B. logical operator C. Compile time operator D.Both A and B above.

14. The statement a*=a is identical to:

A .a =a*a B. a*a =a C. a = a*( a*a) D. None,

15.The assignment statement x+ = y+1; is equivalent to:

A. x = y+(y+1); B. x= y+1; C. x = x +(y+1); D. None

16. The statement a[i++ ] =10; is equivalent to:

A. a[i] =10; i = i+1; B. a[i]= 11; i= i+1; C. a[i]=11; i= a[i]+1; D.None.

17. Bit wise operators may not be applied to :

A. integer arithmetic B. Float or double C. & operator D. unsigned and short.

18. A string constant is a sequence of characters enclosed in:

A. single quotes B. doubles quotes C. braces D.None

19. Given the statement int a=9, b-12,c=3;

x= a –b/3+c*2-1; evaluates to:

A. -2 B. 2 C. 1 D. None.

20. The C assignment statement to evaluate area = r2 + 2 rh is:


A. float radius, height, area;

radius = height = 0.5;

area = 3.14* radius *radius +2*3.14* radius * height;

B. float radius, height, area;

radius = 10.5, height = 10.5;

area = 3.14* radius *radius +2*3.14* radius * height;

C. float radius= 10.5, height= 10.5, area;

area = 3.14* radius *radius +2*3.14* radius * height

D. None.

21. what will be the output of the program:

#include <stdio.h>

int main( )

int y =12;

const int x = y;

printf( “ %d\n”, x);

return 0;

A. 12. B. Garbage value C. Error D None.

22. The difference between a declaration and a definition of a variable is :

A. Both can occur multiple times, but a declaration must occur first.

B. A definition occurs once, but a declaration may occur many times.

C. A declaration occurs once, but a definition is the statement that actually allocates no memory.

D. None.

23. C is a kind of:


A. structured higher level machine independent language.

B. Non procedural language C. Assembly language D. Object oriented language.

24. What will be printed when the sample code below is printed?
int x =0;
for( x=1; x<4; x++);
printf(“x= %d\n”, x);

A 0 B 1 C 3 D 4.

25. what will x contain when the sample code below is executed?
int x =3;
if (x= =2);
x = 0;
if (x = = 3);
x= ++;
else x + = 2;

A.1 B., 2 C.3 D.4

26. An integer constant in c must have:

A. At least one digit B. commas and blanks C. Decimal points D. None.

27. Which one of the following will read a character from the keyboard and will store it in the variable c ?

A. c = getc (); B. getc (&c); C. getchar (&c); D. c = getchar ( );

28. # include <stdio.h>

int i;

void increment (int i);

i++;

int main( )

for ( i= 0; i < 10 , increment (i))

printf ( “ i = %d\n”; i);


return 0;

When the program above is compiled and executed:

A. will not compile B. will print out I =9 C. will print out I = 10 D. It will loop indefinitely.

29. int i =3;


switch =4;
{
default:
;
case 2:
i+= 4;
if (i = = 8)
{
i++;
if (i = = 9) break;
i +=1;
}
i- = 3;
break;

case 8

i+= 4

break;

printf( “i = %d\n”,i)’

The output of the code is”

A i= 4 B i=8 C i=9 D i = 8.

30. The specifier auto will:

A. Automatically initialize a variable to zero.

B. indicates that a variable's memory will automatically be preserved

C. automatically increments the variable when used.

D. automatically initializes a variable to NULL.


31. Which of the following printf ( ) format specifier indicates to print a double value in decimal notation left

Aligned in a 30 character field, to four digits of precision?

A. %-30.4e. B. %4.30e C. -4.30f D. %-30.4f.

32. int x =0;

for(;;)

if ( x++ = = 4)

break;

continue;

printf ( “ x = % d\n”.x );

when the sample code above is executed it will print:

A. x =0 B. x = 1 C. x = 4 D. x =5.

33 . Which one among the following statement is correct, while using function from character handling library?

A. It is a must to include <stdio.h) header file B. The header file <stdio.h> is not needed C. The contents

of the header file <stdio.h) is not a part of the source code during compilation D None.

34. The scanf reads until:

A. A white space character is found in a numeric specification. B. Maximum number of Characters are

read and write. C. When the function arguments are pointers D. None.

35. To identify a block of lines we must:

A. code statements. B. Use braces on separate lines to identify the blocks C. Use Branching statements

D. Use multi way decision statements.

36. The Break statement is:

A one that is Not optional B. one that transfers control out of the switch statement. C. A program

stops its execution when break is encountered. D. Always used with nested loops.

37. A switch statement is one in which :

A. A switch expression can be of any type B. The default label is required in the switch
statement C. It is not permitted to nest switch statements. D. The switch statement tests

the value of a given variable against a list of case values, and when match is found

block of statements associated with that case is executed.

38. When applied to a variable, what does the unary "&" operator yield?

A. The variable’s address. B. The variable's right value

C. The variable's binary form. D. The variables Value.

39. Which one of the following will define a function that CANNOT be called from another

Source file?

A void function() B .extern void function() C. const void function() D. private void

function() .

40. Text enclosed in a pair of quotation marks is a data type:

A. Integer B..long C. string D. variable


41. A memory location with some data that will change is a:

A. .Constant .B. variable. C. named constant. D. symbolic constant.

42. A memory location with some data that will not change is a :

A. Constant B. Variable. C. String. D. Integer.

43. All of the following are required to declare a symbolic constant except:

A. .The Const keyword. B. The data type. C The name of the constant.
D..The value of the constant..

44. The keyword used to declare a variable is:

A. Const. B. Var. C. String. D. Dim.

45. All of the following are required to declare a variable except:

A. The Dim keyword. B. The name of the variable. C .The data type.
D. All of the above are required.

46. To declare more than one variable on the same line, separate the variables with:

A. commas. B. colons. C. pipes. D. semicolons.

48. Which of the following is invalid?

A. ‘ ’ .B .” “. C. ‘a’ D ‘abc’.
49 Variable and constant names can not contain a:

A .number. B. underscore. C .letter. D. period.

50. Variable and constant names can not begin with a:

A number. B. underscore. C. upper-case letter. D .lower-case letter.


51. How long a computer variable remains in memory refers to its:

A.scope. B.lifetime .C.class. D.duration.

52.How widely a variable is recognized to procedures in the project refers to its:

A. scope. B. lifetime. C.class. D.duration.

53.If you want a local variable to preserve its value for the duration of the form, use:

A. the Local statement. B. the Static statement.


C .the Public statement. D .the Dim statement.

54.A variable declared inside an If statement is recognized:

A. throughout the procedure. B. only inside the If statement.


C. throughout the class . D.throughout the program.

55.To make a variable visible to all modules in the project:

A. use the Public keyword .B. use the Private keyword.


C. use the Dim keyword. D .use the Static keyword.

56..The number of significant digits a numeric data type can handle refers to its:

A. significance. B .precision. C .range. D.scope.

57.To show a date literal, you must enclose it in:

A. quotation marks (“). B.single quotes (‘).


C. exclamation points (!). D.pound signs (#).

58.The data type that stores the values True and False is:

A. Boolean. B. Byte .C..Short. D.Integer.

59.The data type often used for counters, which rarely exceed several thousands is:

A.Boolean. B.Byte. C.Short. D.Integer.

60. When the result of a numeric operation exceeds the capacity that a data type can handle, error

occurs.

A.system B.logic C.syntax D. overflow

61.The data type that can handle decimal places is:

A.Long. B.Single. C.Boolean. D..Integer.

62.The data type with the fastest processing time is:


A Integer. B Short. C. Long. D.Quick.

63.The function that. converts an argument into a String data type is:

A. .ToString(). B CStr(). C. ConvertString(). D. MakeString().

64.What is accomplished by the assignment statement “Hourlyplan = txtPay.Text”?

A.The value in the variable HourlyPlan is copied into the txtPay.Text text box.
B.The value in the variable HourlyPlan is compared to the value in txtPay .
C.The value entered in the txtPay text box is copied into the variable Hourlyplan.
D.The value entered in the txtPay text box is compared to the value in the variable
\ Hourlyplan.

65.The statement i += 3 has the same effect as:

a i = i+3 b i = 3. C i-3 = I. D i =3+I.

66.An expression can be a:

A constant. B variable. C combination of constants, variables, and arithmetic operations that


result in a value. D all of the above.

67. All of the following are valid expressions except:

A Sales – Revenues’ B. Mpg, Gallons.


C Pi * Radius ^ 2. D Sales.

68.When several arithmetic operations are combined into one expression, the highest order of

precedence is:

A addition. B.modulus division. C.multiplication. D.power.

69.A string literal must be enclosed in:

A. quotation marks (“). B.single quotes (‘). C.pound signs (#). .D.exclamation points(!).

70 The operator that is only used for string concatenation is the:

A plus sign (+) .. .B underscore (_) . C. “and”. D..ampersand (&).

71.The function that converts the string “345” into a numeric value is:

A. str(“345”). B. val(“345”) c..int(“345”). d.rand(“345”).

72.Text enclosed in quotation marks is a :

A. string data type B. Constant C. numeric data type D none.

73.A memory location with data that will change is recognized as :

A. variable B. constant, C. keyword. D None

74.A constant that is given a name and referenced accordingly is recognized as a

A. Symbolic constant B .Numeric constant, C. argument D .Identifier


75.The expression 9 Mod 4 gives:

A.1 B. 2 C. 9/4 D 0

76.The character that can only be used to concatenate strings is :

A. ampersand (&) B. # C .Caret(^). D. both A and B.

77.According to the Standard C specification, what are the respective minimum sizes (in bytes)
of the following three data types: short; int; and long?

A. 1, 2, 2. B. 1, 2, 4 . C. 1, 2, 8. D. 2, 2, 4.

78. Which one of the following variable names is NOT valid?


A.go_cart
B.go4it.
C.4sea
D.run6

79. C language is available for which of the following Operating Systems?

A.DOS B .Windows C Unix D. all of the above

80. Which of the following symbol is used to denote a pre-processor statement?

A! B. # C. $ D;

82 The number of Keywords in C language consist of :

A. 32 B. 40 C. 24 D. 56

83 which of the following is a keyword for storage class?

A. printf B extern C scanf D auto.

84.Pre processor directives are used for:

A. File Inclusion. B Macro expansion C .Conditional compilation D. all of the above.

85. The pair of functions used for single character I/O are:

A.getchar( ) and putchar() B. scanf() and printf() c. Input() and output() D .None .

86.Function used to read a single character that echoes on the screen , as you type is:
A.getchar() B.Getch() C. getche() D both B&C.

87.The format specification for printing an integer number with minimum field width w is:
A. %wf B. %ld C .% wd D. %wf

88. which one among the following is not a keyword of C?

A. Auto B. register C. int D. function.

89.The operator ?: is:

A .A multi way decision operator B. Two way conditional operator C .loop operator

D. None.

90.Which of the following statement is correct for GOTO:?

A. goto does not break the normal sequential execution f the program

B. The goto requires a lanel and it will be label can be only before the goto statement

C.The goto requires a label n order to udentify the place where branch is to be made.

D All of the above.

91.The while statement is an:

A. Exit controlled loop statement. B. entry controlled loop statement C. Both A&B

D .None.

92. Which of the following statement is correct for Do while loop?

A. It is an exit controlled loop B. the body of the loop is executed many times

C .it is an entry controlled loop D both A& B.

94. Which of the following statement is correct for For loop?

A. An .Entry controlled loop B. Nesting is allowed C. The starting value of the control

variable must be less than its ending value D. Both A &B above.

95. Which of the following statement is correct for Arrays?

A. arrays must be declared before they are used so that the compiler can allocate space for
them in memory B. The type specification such as int is not needed C .Each character of

the string is treated as as an element of the array D .both A and C above.

96. An array can be initialized during:

A Compile time B. Run time c. Execution time D. Both A and B above.

97. Which of the following statement is correct for if-else statements?

A. It is an extension of Simple if. B..If the test expression is true then the true block of

statements immediately following the if are executed C. Both A and B. D. None

98. Which of the following statement is correct about Arrays?.

A. An array is similar to an ordinary variable except that it can store multiple elements of

similar type.

B. array elements are stored in contiguous memory locations

C. array elements can be passed to a function by calling the function by value or by reference

D all of the above.

99. Which of the following statement is correct for switch statement:

A. when we need to choose one among the number alternatives, a switch statement is used.

B. Switch key word is followed by a constant .

C. The case keyword is always followed by a constant.

D.The control falls through any of the cases unless a break statement is encountered.

100. Which of the following statement is correct about while statement?

A. The statements within the while loop would keep on getting executed till the condition

being tested remains true.

B . In the place of condition there can be any other valid expression.

C. The condition being tested may be relational or logical operators.

D. All of the above.


Answer key

1.B 29.D

2.A 30.B

3.B 31.B

4.A 32.A

5.D 33.A

6.C 34.A

7.B 35.B

8.A 36.B

9.B 37.D

10.A 38.A

11.B 39.A

12.B 40.C

13.C 41.B

14.A 42.A

15.C 43.B

16.A 44.D

17.B 45.C

18.B 46.A

19.A 47.B

20.D 48.B

21.B 49.D

22.B 50.A

23.A 51.B

24.A 52.B

25.D 53.B

26.A 54.B

27.D 55.D

28.D 56.A
57.C 86.B

58.D 87.A

59.B 88.D

60.A 89.D

61.B 90.D

62.C 91.C

63.A 92.D

64.D 93.A

65.B 94.D

66.D 95.C

67.A 96.D

68.D 97.A

69.B 98.D

70.A 99.A

71.A 100. D

72.A

73.A

74.A

75.D

76.B

77.A

78.D

79.D

80.A

81.A

82.C

83.D

84.B

85,C

You might also like