0% found this document useful (0 votes)
66 views14 pages

Computer 12 CH09MCQs

Computer 12 CH09MCQs

Uploaded by

l236152
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)
66 views14 pages

Computer 12 CH09MCQs

Computer 12 CH09MCQs

Uploaded by

l236152
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

[Ch#9] Elements of C 259 Computer Science Part-II

Q.1 Fill in the blanks:


1. The first character of a variable name must be an alphabet or underscore.
2. Binary operators operates on two operands.
3. Named memory cells which are used to store programmer’s input and output are
called variables.
4. The maximum length of a character constant is one character.
5. The value of the variable of type int ranges from −32768 to 32767.
6. The value of unsigned int variable ranges from 0 to 65535.
7. The value of float variable ranges from 0 to 10−38 to 10+38.
8. The symbol for logical or operator is | | .
9. Comments are used to increase the readability of the program.
10. Multi line comments start with /* and ends with */.
Q.2 Choose the correct option:
1. Variables are created in:
a) RAM b) ROM
c) HARD DISK d) CACHE
2. Which of the following is a valid character constant?
a) a b) “b”
c) ‘6’ d) =
3. Which of the data type offers the highest precision?
a) float b) long int
c) long double d) unsigned long int
4. When the result of the computation of two very small numbers is too small to be
represented, this phenomenon is called:
a) Arithmetic overflow b) Arithmetic underflow
c) Truncation d) Round off
5. The predefined words of the programming language that are used for special
purposes in the source program are called:
(a) Keywords (b) Statements
(c) Special words (d) Alphabet
6. How many keywords are in C?
(a) 50 (b) 100
(c) 32 (d) 25
[Ch#9] Elements of C 260 Computer Science Part-II
7. A quantity whose value may change during execution of program is called:
(a) Constant (b) string constant
(c) variable (d) token
8. A quantity whose value cannot change during execution of program is called:
(a) constant (b) keyword
(c) variable (d) token
9.  is not a valid variable name:
(a) 6_XYZ (b) roll_no
(c) XYZ (d) ABC
10. The symbol = represents:
a) Comparison operator b) Assignment operator
c) Equal to operator d) None of these
11. Which of the operator has lowest precedence
a) ! b) +
c) = d) = =
12. Relational operators are used to
a) Establish a relationship among variables.
b) Compare two values.
c) Construct compound conditions.
d) Perform arithmetic operations.
13.  is valid variable name:
(a) 2S (b) 2–S
(c) S–2 (d) S2
14. Which of the following characters cannot be used as first character of a variable
name?
(a) 5 (b) x
(c) a (d) z
15. In C, the maximum length of variable name is:
(a) 25 (b) 256
(c) 31 (d) 15
16. C is a strongly typed language, this means that:
a) Every program must be compiled before execution
b) Every variable must be declared before it is being used
c) The variable declaration also defines the variable
d) Sufficient data types are available to manipulate each type of data
[Ch#9] Elements of C 261 Computer Science Part-II
17. The logical not (!) operator is denoted as:
a) Ternary operator b) Unary operator
c) Binary operator d) Bitwise operator
18. a += b is equivalent to
a) b += a b) a =+ b
c) a = a + b d) b = b + a
19. The words used to write the statements of a program are called
a) Special Words b) Words
c) Keywords d) Alphabets
20.  elements of program in not token:
(a) keyword (b) string constant
(c) variable (d) comment
21. In C, the comments are written in program between:
(a) { } (b) /* */
(c) |* *| (d) < >
22.  is used to declare a real type variable:
(a) int (b) float
(c) long (d) char
23.  data types takes only one byte is memory:
(a) int (b) float
(c) long (d) char
24. An identifier whose value can be changed during execution of a program is called
a) token b) string constant
c) constant d) variable
25. Which of the following is not a valid variable name?
a) 3_a b) c_a
c) int1 d) abc
26. Which character cannot be used in a variable name?
a) _ b) ,
c) a d) c
27. How many bytes, the double data type variable takes in memory?
(a) 1 (b) 2
(c) 4 (d) 8
28. How many bytes the long data type variable takes in memory?
(a) 1 (b) 2
[Ch#9] Elements of C 262 Computer Science Part-II
(c) 4 (d) 8
29. In number 0.123 × 10 , the precision is:
6

(a) 0 (b) 3
(c) 6 (d) 5
30. The float data type variable has a precision of:
(a) 15 (b) 6
(c) 3 (d) 5
31. The double data type variable has precision of:
(a) 15 (b) 6
(c) 3 (d) 5
32. The float data type variable has a range of:
(a) 10−30 to 1030 (b) 10−300 to 10300
(c) 10−38 to 1038 (d) 10−308 to 10308
33. The double data type variable has a range of:
(a) 10−30 to 1030 (b) 10−300 to 10300
(c) 10−38 to 1038 (d) 10−308 to 10308
34. Which of the following is used to declare a real type variable?
a) long b) real
c) float d) cha
35. How many bytes the int data type takes in memory
a) 1 b) 2
c) 4 d) 8
36.  is arithmetic operator:
(a) = (b) ==
(c) % (d) &&
37.  is valid character constant:
(a) a (b) “a”
(c) ‘a’ (d) None
38.  is increment operator:
(a) + (b) =+
(c) ++ (d) --
39.  is a modulus operator:
[Ch#9] Elements of C 263 Computer Science Part-II
(a) ! (b) %
(c) ++ (d) /
40. If a = 19, then after execution of the statement b = a %5; the value of b will be:
(a) 5 (b) 4
(c) 2.71 (d) 2
41. The value returned by expression 3+3*5 will be:
(a) 16 (b) 18
(c) 12 (d) 8
42. How many bytes the float data type takes in memory
a) 1 b) 2
c) 4 d) 8
43. How many bytes the char data type takes in memory
a) 1 b) 2
c) 4 d) 8
44. Which of the following is an arithmetic expression?
a) ab&&cd b) ab+cd
c) !ab d) ab>cd
45.  data type offers the highest precision:
(a) float (b) long int
(c) long double (d) long float
46. How many logical operators are in C?
(a) 4 (b) 3
(c) 2 (d) 6
47.  is arithmetic expression:
(a) a && b (b) a+b
(c) !a (d) a>b
48. +,-,/,% and * are:
(a) Relational operators (b) Logical operators
(c) Arithmetic operators (d) None
49. If x = 3, then after executing the statement “x = x − −;”, the value of x will be:
(a) 2 (b) 3
(c) 1 (d) 4
50. If simple assignment statement is “x = x + 2;”, then its equivalent compound
assignment statement is:
[Ch#9] Elements of C 264 Computer Science Part-II
(a) x ++ = 2 (b) x + = 2;
(c) x = + 2; (d) y = x + 2;
[Ch#9] Elements of C 265 Computer Science Part-II
51. The value of 15%2 is
a) 7 b) 7.5
c) 2 d) 1
52. What will be the value of ‘x’ after executing the following statements?
float y = 6.59;
int x = 2;
x = y;
(a) 2 (b) 6.59
(c) 6 (d) 7
53. What will be the value of ‘x’ after executing the following statements?
int x = 2;
x + = x ++;
(a) 4 (b) 5
(c) 3 (d) 6
54. The names used to represent variables, constants , types functions etc are called
a) Words b) Characters
c) Identifiers d) All of Above
55. There are ____ types of identifiers in C language
a) 2 b) 3
c) 4 d) 1
56. Which one is not an example of standard identifier
a) printf b) if
c) sqroot d) else
57. The reserve words cannot be
a) Used in program b) Redefined
c) Copied d) All of Above
58. Initialization of a variable refers to
a) Value at the time of declaration b) Value at any time with in the program
c) Value after the program execution d) All of Above
59. What will be the value of ‘y’ after executing the following statements?
int y = 3
y = y + (++y);
(a) 8 (b) 7
(c) 4 (d) 6
[Ch#9] Elements of C 266 Computer Science Part-II
60.  is not a valid variable name:
(a) a123 (b) my name
(c) real (d) float
61.  data types is used to store real value:
(a) float (b) double
(c) long double (d) All
62. Which of the following data can be stored by “int” type variable?
(a) “2564” (b) -56.25
(c) 487596 (d) None
63.  statements is not valid:
(a) char char = ‘a’; (b) char ch = ‘a’;
(c) char ch = ‘9’; (d) char ch = ‘A’;
64.  statements is valid for declaring variable(s):
(a) float height; (b) int x, y, z;
(c) double marks, total; (d) All
65. Assigning a value to a variable at the time of its declaration is called:
(a) Initializing (b) Assigning
(c) Declaring (d) Naming
66. Which one is a valid variable name
a) @home b) #home
c) _home d) home+
67. A variable can be declared for ____ data type
a) One b) Two
c) Three d) Multiple
68.  statement is valid for initializing variable(s):
(a) float height = 5.5; (b) int x = 2, y = 5, z = 6;
(c) char ch = ‘D’; (d) All
69.  is valid character constant:
(a) ‘A’ (b) ‘6’
(c) ‘$’ (d) All
[Ch#9] Elements of C 267 Computer Science Part-II
70. The ‘int’ data type variable has a range of:
(a) -32768 to +32767 (b) 0 to 256
(c) 0 to 65536 (d) None
71. An expression may consist of:
(a) operands (b) operators
(c) Both (a) and (b) (d) None
72. An arithmetic expression may consist of:
(a) variables (b) constants
(c) arithmetic operators (d) All
73.  is not an arithmetic operator:
(a) + (b) /
(c) × (d) %
74. The value of expression 2%3 is:
(a) 2 (b) 3
(c) 0 (d) None
75. _________ defines a set of values and a set of operations on those values
a) Data b) Constant
c) Data Type d) None of Above
76. The predefined data types of C language are called
a) User defined data types b) Standard data types
c) Normal data types d) None of Above
77. Which one is not an example of standard data type of C language
a) int b) float
c) char d) real
78. Which range refers to unsigned int data type of C language
a) 0 to 32768 b) 0 to 32767
c) 0 to 65536 d) 0 to 255
79. The value of expression 11%3 is:
(a) 2 (b) 3
(c) 3,66 (d) None
[Ch#9] Elements of C 268 Computer Science Part-II
80. The value of expression 11%3*5 is:
(a) 2 (b) 10
(c) 15 (d) None
81.  valid assignment statement:
(a) x = 10; (b) x = x+y*3;
(c) x = y; (d) All
82.  is valid statement to add 1 to variable x:
(a) x++; (b) x = x +1
(c) x + = 1; (d) All
83. Which range refers to signed int data type of C language
a) -32768 to 32767 b) 0 to 32767
c) 0 to 65536 d) 0 to 255
84. Long double data type of C language requires ____ bytes of memory
a) 2 b) 4
c) 10 d) 8
85.  has higher order of precedence:
(a) + (b) ()
(c) * (d) /
86. How many relational operators in C?
(a) 4 (b) 3
(c) 2 (d) 6
87. Which of the following is relational operator?
(a) = (b) ==
(c) % (d) &&
88.  is not relational operator:
(a) != (b) ==
(c) = (d) <=
89. An expression that uses relational expression is represented by:
(a) Relational expression (b) Arithmetic expression
(c) Logical expression (d) None
[Ch#9] Elements of C 269 Computer Science Part-II
90. A relational expression may return value:
(a) True (b) False
(c) Both a & b (d) None
91. The true value return by relational expression is represented by:
(a) 0 (b) 1
(c) Less then zero (d) None
92.  returns True If X =5 and Y = 10:
(a) X>=Y (b) X >Y
(c) X==Y (d) X!=Y
93.  returns False if X = 5 and Y = 10:
(a) X<Y (b) X <= Y
(c) X>Y (d) X!=Y
94.  operators is used to join two conditions:
(a) Relational operator (b) Arithmetic operator
(c) Assignment operator (d) Logical operator
95.  is logical operator:
(a) AND (b) OR
(c) NOT (d) All of these
96. The logical NOT operator, denoted by !, is a:
(a) Ternary operator (b) Unary operator
(c) Binary operator (d) Bitwise operator
97.  is logical operator:
(a) = (b) ==
(c) % (d) &&
98.  logical operators is unary operator:
(a) && (b) ||
(c) ! (d) None
99. &&, || and ! are:
(a) Relational operators (b) Logical operators
(c) Arithmetic operators (d) None
[Ch#9] Elements of C 270 Computer Science Part-II
100.  symbols is used for logical OR operator:
(a) && (b) ||
(c) ! (d) |
101.  symbols is used for logical AND operator:
(a) && (b) ||
(c) & (d) !
102.  symbols is used for logical NOT operator:
(a) && (b) ||
(c) ! (d) None
103.  is equivalent to !(p>=q):
(a) p=q (b) p<q
(c) p>q (d) !p<q
104.  not a logical operator:
(a) || (b) !
(c) && (d) >
105.  returns True if X = 2 and Y =3:
(a) !(X >Y) (b) (X > Y) || (Y > 2)
(c) (X < Y) && (X>=2) (d) All of these
106.  returns Falst if X = 2 and Y = 3:
(a) (X = = Y) || (Y > X ) (b) (X = = 2) && (Y > 2)
(c) (X < Y) && (X > 2) (d) !(Y >3)
107.  is not a logical operator:
(a) || (b) &&
(c) != (d) !
Q.3 Write T for True and F for false Statements.
1. printf and scanf are standard identifiers. (T)
2. In C language, all variables must be declared before being used. (T)
[Ch#9] Elements of C 271 Computer Science Part-II
3. Standard data types are not predefined in C language. (F)
4. The double data type required 4 bytes memory. (F)
5. In scientific notation the exponent represent the value of the number and
(F)
mantissa represents the power to which it is raised.
6. The symbol for modulus operator is %. (T)
7. The symbol = is used to compare two values. (T)
8. Operator precedence determines the order of evaluation of the operators in
(T)
an expression.
9. For many compilers a C variable name can be up to 31 characters. (T)
10. C program can only use lower case letters in variable names. (F)
Q.4 What data type would you use to represent the following items?
Item Data type
Number of children at you school int
A letter grade on an exam char
The average marks of your class float
Q.5 Which of the following are valid variable name in C?
Sr No Identifier/ Name Valid/invalid Invalid Reason
1) income Valid
2) total marks Invalid Space is not allowed
3) double Invalid C reserve word
4) average-score Invalid Symbol is not allowed
5) room# Invalid Symbol is not allowed
6) _area Valid
7) no_of_students Valid
8) long Invalid Reserve Words
9) Item Valid
10) MAX_SPEED Valid
[Ch#9] Elements of C 272 Computer Science Part-II
Q.6 Let w, x, y and z\ are four float type variables. Let a, b, and c are variables of
int type. Then correct the following statements:

Sr. No Incorrect Statement Correct Statement

1) z=4.0w*y; z=4.0*w*y;

2) y=yz; y=y*z;

3) a=6b4; a=6*b*4;

4) c=3(a+b); c=3*(a+b);

5) z=7w+xy; z=7*w+x*y;

Q.7 Evaluate the expressions.


int a, b, c, d, p;
float v, w, x, y, z;
Values of variable are:
a=2; z=1.3; c=1; d=3; y=0.3E+1;

Sr.# Expression Calculation Result

1) v=a*2.5/y; v=2*2.5/3; 1.666667

2) w=a/y; w=2/3.0; 0.666667

3) p=a/d; p=2/3; 0

4) x=(a+c)/(z+0.3); x=(2+1)/(1.3+0.3)=3/1.6 1.875000

5) b=d/a+d%a; b=3/2+3%2=1+1 2

6) y=c/d*a; y=1/3*2=0*2 0

You might also like