ccp objectives
Post on 06-Apr-2018
229 Views
Preview:
TRANSCRIPT
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 1/18
S.D.COLLEGE OF ENGG. & TECH., MUZAFFARNAGAR COMPUTER CONCEPT & PROGRAMMING IN ‘C’ (ECS-101/ 201)
OBJECTIVE QUESTION BANK
1. Which of the following language is predecessor to C Programming Language?
A B BCPL C++
2. C programming language was developed by
Dennis Ritchie Ken Thompson Bill Gates Peter Norton
3. C was developed in the year ___
1970 1972 1976 1980
4. C is a ___ language
High Level Low Level Middle Level Machine Level
5. C language is available for which of the following Operating Systems?
DOS Windows Unix All of these
6. Which of the following symbol is used to denote a pre-processor statement?
! # ~ ;
7. Which of the following is a Scalar Data type
Float Union Array Pointer
8. Which of the following are tokens in C?
Keywords Variables Constants All of the above
9. What is the valid range of numbers for int type of data?
0 to 256-32768 to
+32767
-65536 to
+65536No specific range
10. Which symbol is used as a statement terminator in C?
! # ~ ;
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 2/18
11. Which escape character can be used to begin a new line in C?
\a \b \m \n
12. Which escape character can be used to beep from speaker in C?
\a \b \m \n
13. Character constants should be enclosed between ___
Single quotes Double quotes Both a and b None of these
14. String constants should be enclosed between ___
Single quotes Double quotes Both a and b None of these
15. Which of the following is invalid?
‘’ “ “ ‘a’ ‘abc’
16. The maximum length of a variable in C is ___
8 16 32 64
17. What will be the maximum size of a float variable?
1 byte 2 bytes 4 bytes 8 bytes
18. What will be the maximum size of a double variable?
1 byte 4 bytes 8 bytes 16 bytes
19. A declaration float a,b; occupies ___ of memory
1 byte 4 bytes 8 bytes 16 bytes
20. The size of a String variable is
1 byte 8 bytes 16 bytes None of these
21. Which of the following is an example of compounded assignment statement?
a = 5 a += 5 a = b = c a = b
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 3/18
22. The operator && is an example for ___ operator.
Assignment Increment Logical Rational
23. The operator & is used for
Bitwise AND Bitwise OR Logical AND Logical OR
24. The operator / can be applied to
integer values float values double values All of these
25. The equality operator is represented by
:= .EQ. = ==
26. Operators have hierarchy. It is used to know which operator
is most
importantis used first is faster
operates on
large numbers
27. The bitwise AND operator is used for
Masking Comparison Division Shifting bits
28. The bitwise OR operator is used to
set the desiredbits to 1
set the desiredbits to 0
divide numbersmultiply
numbers
29. Which of the following operator has the highest precedence?
* == => +
30. The associativity of ! operator is
Right to Left Left to Right
(a) for
Arithmetic and (b)for Relational
(a) for Relational
and (b) for Arithmetic
31. Which operator has the lowest priority?
++ % + ||
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 4/18
32. Which operator has the highest priority?
++ % + ||
33. Operators have precedence. A Precedence determines which operator is
fastertakes less
memoryevaluated first
takes noarguments
34. Integer Division results in
Rounding the
fractional part
truncating the
fractional partFloating value
An Error is
generated
35. Which of the following is a ternary operator?
? * sizeof ^
36. What will be the output of the expression 11 ^ 5?
5 6 11 None of these
37. The type cast operator is
(type) cast() // " "
38. Explicit type conversion is known as
Casting Conversion Disjunction Separation
39. The operator + in a+=4 means
a = a + 4 a + 4 = a a = 4 a = 4 + 4
40. p++ executes faster than p+1 because
p uses registersp++ is a single
instruction
++ is faster than
+None of these
41. Which of the following statements is true?
C Library
functions provide I/Ofacilities
C inherent I/Ofacilities
C doesn’t haveI/O facilities
Both (a) and (c)
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 5/18
42. Header files in C contain
Compiler
commandsLibrary functions
Headerinformation of C
programs
Operators for
files
43. Which pair of functions below are used for single character I/O.
Getchar() and
putchar()
Scanf() and
printf()
Input() and
output()None of these
44. The printf() function retunes which value when an error occurs?
Positive value Zero Negative value None of these
45. Identify the wrong statement
putchar(65) putchar('x') putchar("x") putchar('\n')
46. Which of the following is charecter oriented console I/O function?
getchar() and
putchar()gets() and puts()
scanf() and
printf()
fgets() and
fputs()
47. The output of printf("%u", -1) is
-1minimum int
value
maxium int
valueError message
48. An Ampersand before the name of a variable denotes
Actual Value Variable Name Address Data Type
49. Symbolic constants can be defined using
# define const symbols None of these
50. Null character is represented by
\n \0 \o \e
51. Which header file is essential for using strcmp() function?
string.h strings.h text.h strcmp.h
52. malloc() function used in dynamic allocation is available in which header file?
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 6/18
stdio.h stdlib.h conio.h mem.h
53. File manipulation functions in C are available in which header file?
streams.h stdio.h stdlib.h files.h
54. C supports how many basic looping constructs
2 3 4 6
55. A statement differs from expression by terminating with a
; : NULL .
56. What should be the expression return value for a do-while to terminate
1 0 -1 NULL
57. Which among the following is a unconditional control structure
do-while if-else goto for
58. continue statement is used
to go to the nextiteration in a loop
come out of aloop
exit and returnto the main function
restarts
iterations frombeginning of loop
59. Which operator in C is called a ternary operator
if..then ++ ? ()
60. Which of the following header file is required for strcpy() function?
string.h strings.h files.h strcpy()
61. The meaning of conversion character for data input is
Data item is along integer
Data item is an
unsigned decimalinteger
Data item is ashort integer
None of theabove
62. The conversion characters for data input means that the data item is
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 7/18
An unsigneddecimal integer
A short integerA hexadecimal
integerA string followed
by white space
63. An expression contains relational, assign. ment and arithmetic operators. If
Parenthesis are not present, the order will be
Assignment,
arithmetic, relational
Relational,arithmetic,
assignment
Assignment,
relational, arithmetic
Arithmetic,relational,
assignment
64. Which of the following is a key word is used for a storage class
printf external auto scanf
65. In the C language 'a’ represents
a digit an integer a character a word
66. The number of the relational operators in the C language is
Four Six Three One
67. A compound statement is a group of statements included between a pair of
double quote curly braces parenthesis a pair of /’s
68. A Link is
a compileran active
debuggera C interpreter
a analyzing tool
in C
69. The continue command cannot be used with
for switch do while
70. In C, a Union is
memory location memory store memory screen None of these
71. When the main function is called, it is called with the arguments
argc argv None of these both a & b
72. A multidimensional array can be expressed in terms of
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 8/18
array of pointersrather than as
pointers to a group
of contiguous array
array without
the group of
contiguous array
data type arrays None of these
73. C allows arrays of greater than two dimensions, who will determined this
programmer compiler parameter None of these
74. A pointer to a pointer in a form of
multiple
indirection
a chain of
pointersboth a and b None of these
75. Pointers are of
integer data typecharacter data
typeunsigned integer
data typesNone of these
76. Maximum number of elements in the array declaration int a[5][8] is
28 32 35 40
77. If the size of the array is less than the number of initializers then,
Extra values are
being ignored
Generates an
error message
Size of Array is
increased
Size is neglectedwhen values are
given
78. Array subscripts in C always start at
-1 1 0Value provided
by user
79. A Structure
can be read as asingle entity
cannot be readas a single entity
can be displayedas a single entity
has membervariables that cannotbe read individually
80. Identify the invalid pointer arithmetic
Addition of floatvalue to a pointer
Comparision of
pointers that do notpoint to the element
of the same array
Subtracting aninteger from a
pointer
Assigning thevalue 0 to a pointer
variable
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 9/18
81. C programs are converted into machine language with the help of
(1) An Editor (2) A compiler
(3) An operating system
(4) None of the above
82. The real constant in C can be expressed in which of the following forms
(1) Fractional form only(2) Exponential form only
(3) ASCII form only
(4) Both fractional and exponential forms
83. A character variable can at a time store
(1) 1 character
(2) 8 characters
(3) 254 characters(4) None of the above
84. Which of the following is NOT a character constant
(1) ‘Thank You’
(2) ‘Enter values of P, N, R’
(3) ‘23.56E-03’(4) All the above
85. Which of the following statement is wrong(1) mes = 123.56 ;
(2) con = 'T' * 'A' ;
(3) this = 'T' * 20 ;(4) 3 + a = b ;
86. Which of the following shows the correct hierarchy of arithmetic operators in C(1) **, * or /, + or -
(2) **, *, /, +, -
(3) **, /, *, +, -
(4) / or *, - or +
87. In b = 6.6 / a + 2 * n ; which operation will be performed first?
(1) 6.6 / a(2) a + 2
(3) 2 * n
(4) Depends upon compiler
88. Which of the following is allowed in a C Arithmetic instruction
(1) [ ]
(2) { }(3) ( )
(4) None of the above
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 10/18
89. Which of the following statements is false
(1) Each new C instruction has to be written on a separate line(2) Usually all C statements are entered in small case letters
(3) Blank spaces may be inserted between two words in a C statement
(4) Blank spaces cannot be inserted within a variable name
90. Hierarchy decides which operator
(1) is most important(2) is used first
(3) is fastest
(4) operates on largest numbers
91. An integer constant in C must have:
(1) At least one digit
(2) At least one decimal point
(3) A comma along with digits(4) Digits separated by commas
92. A character variable can never store more than
(1) 32 characters
(2) 8 characters
(3) 254 characters(4) 1 character
93. In C a variable cannot contain
(1) Blank spaces
(2) Hyphen(3) Decimal point
(4) All the above
94. Which of the following is FALSE in C
(1) Keywords can be used as variable names
(2) Variable names can contain a digit
(3) Variable names do not contain a blank space(4) Capital letters can be used in variable names
95. In C, Arithmetic instruction cannot contain(1) variables
(2) constants
(3) variable names on right side of =(4) constants on left side of =
96.Which of the following shows the correct hierarchy of arithmetic operations in C
(1) / + * -(2) * - / +
(3) + - / *
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 11/18
(4) * / + -
97. What will be the value of d if d is a float after the operation d = 2 / 7.0?(1) 0
(2) 0.2857
(3) Cannot be determined(4) None of the above
98. An expression contains relational operators, assignment operators and
arithmetic operators. In the absence of parentheses, they will be
evaluated in which of the following order:(1) assignment, relational, arithmetic
(2) arithmetic, relational, assignment(3) relational, arithmetic, assignment(4) assignment, arithmetic, relational
99. The break statement is used to exit from:
(1) an if statement(2) a for loop
(3) a program(4) the main( ) function
100. A do-while loop is useful when we want that the statements within theloop must be executed:
(1) Only once
(2) At least once(3) More than once(4) None of the above
101.In what sequence the initialization, testing and execution of body is donein a do-while loop
(1) Initialization, execution of body, testing
(2) Execution of body, initialization, testing(3) Initialization, testing, execution of body
(4) None of the above
102.
Which of the following statement is used to take the control to the beginning of the loop?
(1) exit(2) break
(3) continue(4) None of the above
103. What would happen if you try to put so many values into an array when
you initialize it that the size of the array is exceeded?
(1) nothing
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 12/18
(2) possible system malfunction(3) error message from the compiler (4) other data may be overwritten
104. In an array int arrI12I the word arr represents the a _______ of
the array
105. What would happen if you put too few elements in an array when youinitialize it?
(1) nothing
(2) possible system malfunction(3) error message from the compiler
(4) unused elements will be filled with 0’s or garbage
106 .What would happen if you assign a value to an element of an array whose
subscript exceeds the size of the array?
(1) the element will be set to 0
(2) nothing, it’s done all the time
(3) other data may be overwritten(4) error message from the compiler
1 0 7 . When you pass an array as an argument to a function, what actually gets
passed?
(1) address of the array(2) values of the elements of the array
(3) address of the first element of the array(4) number of elements of the array
108. Which of these are reasons for using pointers?
(1) To manipulate parts of an array(2) To refer to keywords such as for and if
(3) To return more than one value from a function(4) To refer to particular programs more conveniently
109. If you don’t initialize a static array, what would be the elements set
to?(1) O(2) an undetermined value
(3) a floating point number (4) the character constant ‘\O‘
110. To receive the string “We have got the guts, you get the glory!!“ inan array c h ar s t r [ 100 ] which of the following functions would you use?
(1) scanf ( “%s“, str ) ;(2) gets ( str ) ;
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 13/18
(3) getchar( str ) ;(4) fgetchar ( str ) ;
111. The format string of a printf( ) function can contain:
(1) Characters, format specifications and escape sequences(2) Character, integers and floats
(3) Strings, integers and escape sequences(4) Inverted commas, percentage sign and backslash character
112. The C language terminator is
(1) semicolon(2) colon
(3) period
(4) exclamation mark
113. int x = 0;
for (x=1;x<4;x++);printf(“x=%d \n”,x);
What will be printed when the sample code above is executed?
a) x = 0 b) x = 1 c) x = 3
d) x = 4 e) x = 5
114. int i = 4;
Switch (i)
{default:
;
Case 3:
i+= 5;
if(i = = 8){
i++;
if (i = = 9) break;
i*= 2;
}
i - = 4;
break;case 8:
i += 5;
break;
}
Printf(“i = %d\n”,i);
What will the output of the above sample code?
a) i = 5 b) i = 8 c) i = 9 d) i = 10 e) i = 18
115. According to the C specification.what are the respective minimum sizes (in bytes) of the
following three data types: short; int ; and long?
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 14/18
a) 1,2,2 b) 1,2,4c) 1,2,8 d) 2,2,4 e) 2,4,8
116. int x = 2*3 + 4*5;
What value will x contain in the sample code above?
a) 22 b) 26 c) 46 d) 50 e) 70
117. predicted the output of the following code :
main()
{
int i=012;
int j=034;
int k=056;
printf(“i= %d\n”,i);
printf(“j= %d\n”,j);
printf(“k= %d\n”,k);
}
a) i=12 j=34 k=56 b) i=24 j=68 k=112c) i=3 j=28 k=46 d) i=10 j=28 k=46
118. The operator !, falls under the category of ----------- operators.
a) Conditional b) Unary
c) Modulo d) Boolean complement
119. predicted the output of the following code :
main()
{int I=16, j= 17;
i=i>>1;
j=j>>1;
printf(“i= %d\n”,I);
printf(“j= %d\n”,j);
}
a) i=8 j=8 b) i=7 j=7 c) i=8 j=9 d) i=7 j=8
120. In which type of the loop,is the inner loop is executed completely for every execution of the
outer loop?
a) do…while b) if c) Nested d) for
121. Which one is NOT the valid identifier?
a) _ident b) auto c) Bignumber d) g434gh
122. 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 variable’s value
123. void main()
{
int a=10,b=20,c=0;
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 15/18
if (a,b,c)
printf(“EXAM”);
else
printf(“exam”);
}What is output?
a) EXAM b) exam c) Compiler Error d) No Output
124. Header files in C contains
a) Compiler Commands b) Library Functions
c) Operators for Files d) Header Information of C Program
125. continue statement is used
a) to go to the next iteration in a loop
b) come out of a loop
c) exit & return to the main function
d) restart iteration from beginning of loop
126. Identify the correct syntax for declaring the array:a) int i= {1,2,3,4}; b) int i[4]= {1,2,3,4};
c) int i=[1,2,3,4]; d) int i[4]=[1,2,3,4];
127. If the size of the array is less than the number of initilizers then,
a) Extra values are being ignored b) Generates an error message
c) Size of array is increased d) Size is neglected
128. Array subscript in C always start at
a) -1 b) 1 c) 0 d) Value given by user
129. void main()
{int a[5]= {2,3};
printf(“%d%d%d”,a[2],a[3],a[4]);
}
a) garbage value b) 233 c) 322 d) 000
130. void main()
{
static int a[20];
int i=0;
a[i]=i+1; printf(“%d%d%d”,a[0],a[1],i);
}a) 100 b) 010 c) 001 d) 110
131. Format specifier for Hexadecimal number is
a) %d b) %O c) %X d) %U
132. The back slash character used for new line is:
a) ‘\a’ b) ‘\n’ c) ‘\b’ d) ‘\0’
133. main(){
int x=128;
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 16/18
printf (“%d”,1+x++);
}
(a) 128 (b) 129 (c) 130 (d) 1134. main(){
int x=2,y=6,z=6;x=y= = z;
printf(%d”, x);}(a) 2 (b) 6 (c) 1 (d) none of these
135.main(){
int i=10,m=10;
printf(“%d”, i>m?i*i:m/m,20);}
(a) 20 (b) 1 (c) 1 20 (d) 100 20
136.main(){
int x;
printf(“%d”, x=20,x=30);
printf(“%d”, x);}(a) compile time error (b) 20 30 (c) 30 30 (d) 20 20
137.The data type of the controlling statement of a switch statement cannot be of the type(a) int (b) char (c) short (d) float
138.main(){
int a=10, b=6;
if (a=3)
b++;
printf(“%d %d”, a, b++);}
(a) 10 6 (b) 10 7 (c) 3 6 (d) 3 7
139.main(){
int i=0;
for ( i=0; i<20; i++){switch(i) {
case 0: i +=5;
case 1: i +=2;
case 5: i +=5;
default : i +=4; break;}
printf (“%d ,” ,i);
}}(a) 0,5,9,13,17 (b) 5,9,13,17 (c) 12, 17, 22 (d) 16,21
140.main(){
int x = 6;switch( x ){
default : x += 2;
case 4 : x = 4;
case 5 : x++;
break;}
printf (“%d”, x);}
(a) 8 (b) 6 (c) 5 (d) 4
141.main(){
char a[10]= “hello”;
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 17/18
strcpy (a, ‘\0’);
printf (“%s”, a);}
(a) Null String (b) Non-Null String (c) hello (d) error
142.How long does this loop run: for ( x = 0; x = 3; x++)(a) Never (b) Three Times (c) Four Times (d) Forever
143.main()
{
int i=012;
int j=034;
int k=056;
printf(“i= %d\n”,i); printf(“j= %d\n”,j);
printf(“k= %d\n”,k);
}(a) i=12 j=34 k=56 (b) i=24 j=68 k=112(c) i=3 j=28 k=46 (d) i=10 j=28 k=46
144. C is a __________ language
(a) High Level (b) Low Level (c) Middle Level (d) Machine Level.
145. Header files in C contains(a) Compiler Commands (b) Library Functions(c) Operators for Files (d) Header Information of C Program
146. Which of the following symbol is used to denote the pre-processor statement?(a) @ (b) # (c) % (d) ;
147. How do you include a system header file called sysheader.h in a C source file?
(a) #include<sysheader.h> (b) #incl”sysheader.h”(c) #incl<sysheader.h> (d) #include sysheader.h
148. What is the range of an integer variable?(a) -32768 to 32767 (b) -32768 to 32767 (c) -128 to 127 (d) None of these
149. What is the back slash character used for backspace is:
( a) ‘\a’ (b) ‘\n’ (c) ‘\b’ (d) ‘\0’
150. The size of string variable is:
(a) 1 byte (b) 4 bytes (c) 8 bytes (d) None of these
151. Which of the following keyword is used for storage class is:
(a) printf (b) external (c) auto (d) automatic
152. C is which kind of language?
(a) Machine (b) Procedural (c) Assembly (d) Object Oriented
153 int x = 0;
for (x=1;x<4;x++);
printf(“x=%d \n”,x);
What will be printed when the sample code above is executed?
(i) x = 0 (ii) x = 1 (iii) x = 3 (iv) x = 4
8/3/2019 Ccp Objectives
http://slidepdf.com/reader/full/ccp-objectives 18/18
154. According to the C specification.what are the respective minimum sizes (in bytes) of the
following three data types: short; int ; and long?
(i) 1,2,2 (ii) 1,2,4 (iii) 1,2,8 (iv) 2,2,4
155. Which one is NOT the valid identifier?
(i) _ident (ii) auto (iii) Bignumber (iv) g434gh
top related