MCQ
MCQ
a.int ary{}={1,2,3,4};
b.int ary[] =[1,2,3,4];
c.int ary[] ={1,2,3,4};
d.int ary{4}=[1,2,3,4];
Ans=c
3.Which of the following statements assign the value stored in x to the first element on an
array,ary?
a.ary=x;
b.ary=x[0];
c.ary=x[1];
d.ary[0]=x;
Ans=d
6C language has been developed by
A) Ken Thomson
B) Dennis Ritchie
C) Peter Norton
D) Martin Richards
Ans:B
9.C is a
A) Middle level language
B) High level language
C) Low level language
D) None of the above
Ans:D
1.%d
2. 25637
3.37
4. %
Ans =1
21.C is a
1. Middle level language.
2. high level language.
3. low level language.
4. none of these.
Ans =4
a] Ken Thomspon
b] Dennis Ritche
c] Martin Richard
d] Nats Thomson
Ans-b
Ans-d
25.A character variable can at a time store
a] 1
b] 8
c] 256
d] 1024
Ans-a
Ans-b
Ans-d
28. C programme are converted into machine level language with the help of
A) an interpreter
B) a compiler
C) an operating system
D) none of the above
Ans=B
A) 51234
B) 12345
C) 35241
D) 54321
Ans=B
Ans-b
Ans-c
Ans-a
Ans-b
Ans-a
38)float is denoted by
a)%d
b)%f
c)%d
d)%a
ans-b
a.Ken Thomson
b.Dennis Ritchie
c.Peter Norton
d.Martin Richards
ans.Dennis Ritchie
a.an editor
b.a compiler
c.an operating system
d.none
ans.a compiler
a.1 character
b.8 characters
c.254 characters
d.none
ans.1 character
ans.32767
a.Ken Thomson
b.Dennis Ritchie
c.Peter Norton
d.Martin Richards
ans.Dennis Ritchie
a.an editor
b.a compiler
c.an operating system
d.none
ans.a compiler
a.1 character
b.8 characters
c.254 characters
d.none
ans.1 character
ans.2
ans.0
51.The members declared under ____ visibility label are hidden from external use.
(i) public
(ii) private
(iii) both (i) & (ii)
(iv) none of these
(v) printf
(vi) Printf
(vii) scanf
(viii) int a;
(ix) #include<string.h>
(x) #include<iostream.h>
(xi) #include<fstream.h>
(xii) #include<iostring.h>
(xiii) int
(xiv) float
(xv) double
(xvi) none of these
(xvii) integer
(xviii) class
(xix) structure
(xx) float
56.FORTRAN is………….language.
a)low level
b)high level
c)mid level
d)machine level
ans.(b)
57)An integer constant must have
a)At least one decimal point
b)A commas along with digit
c)At least one digit
d)Digits separeted by commas
ans.(c)
58)…….reads full line of input into a string until a new line or EOF is encountered
a)puts
b)gets
c)printf
d)scanf
ans.(b)
59)Floats occupy……….bytes in memory
a)3
b)2
c)4
d)5
ans.(c)
60)&& is…………………..
a)Arithmatic operator
b)Relational operator
c)Logical operator
d)Assignment operator
ans.(c)
61)A character variable can at a time store………character.
a)1
b)8
c)254
d)2
ans.(a)
62.Float*ptr :
In the above declaration data type of ptr is______ and data type of
variable pointed by ptr is______.
(ii) Float,int
Ans :- (iv);pointer,float
63.Last character of a string is-
(i) 0
(ii) \0
(iii) \n
(iv) End
Ans :- (ii); \0
64.When we use string functions such as strlen(), strrev() etc. Then must
include file –
(i) #include<string.h>
(ii) #include<iostream.h>
(iii) #include<fstream.h>
(iv) #include<iostring.h>
(i) Public
(ii) Protected
(iii) Private
Ans :- (iii),private
66.When a member function is defined inside the class, then it is treated
as a ____ function-
(i) Inline
(ii) Outline
(iii) External
(iv) Virtual
(i) Class
(ii) Array
(iii) Function
(iv) Pointer
(i) Single
(ii) Multiple
(iii) Multilevel
(iv) Hierarchical
(i) Polymorphism
(ii) Inheritance
(iv) Database
(a) 1 character
(b) 8 chatacters
ANS=b
75.Which of the following statement is false
ANS=a
76. Identify the correct statement
Main( )
{
Char str1[]=”hello”;
Char
str2[]=”hello”;
If (strl=str2)
Printf(“\nequal”);
Else
Printf(“\nunequal”);
}
a. equal
b. unequal
c. error
d. none of these
ANS= a
78.if the file to be included does not exist the pre processor flashes an error message?
1. true
2. false
3.none of these
ANS=1
1 yes
2 no
3 none of these
ANS=1
80.usually recursion works slower than loops
1 true
2 false
3 none of these
ANS=a
81.In the following code in which order the function would be called?
1 .F1, f2, f3
2 .F3, f2, f1
3 .The order may vary from compiler to compiler
4 .None of these
ANS=b
82.Float*ptr :
In the above declaration data type of ptr is______ and data type of
variable pointed by ptr is______.
(vi) Float,int
Ans :- (iv);pointer,float
83.Last character of a string is-
(v) 0
(vi) \0
(vii) \n
(viii) End
Ans :- (ii); \0
84.When we use string functions such as strlen(), strrev() etc. Then must
include file –
(v) #include<string.h>
(vi) #include<iostream.h>
(vii) #include<fstream.h>
(viii) #include<iostring.h>
Ans :- (i); #include<string.h>
85.If all visibilitiy lebels are missing, then by default members of class are
–
(v) Public
(vi) Protected
(vii) Private
Ans :- (iii),private
86.When a member function is defined inside the class, then it is treated
as a ____ function-
(v) Inline
(vi) Outline
(vii) External
(viii) Virtual
A) wright brother
B) charles babbage
C) dennis ritchis
D) graham bell
Ans-C
A) shift right
B) shift left
C) more greater than
D) more less than
Ans-B
A) Input/ output
B) Computation
C) Subroutine
D) Connector
Ans-B
90.Algorithem is
91.”ftell”
Ans-C
94)the real constant inc can be expressed in which of the following forms
1)fractional only
2)exponential only
3)ASCII value form only
4)both 1,2
Ans:exponential only
140.Detect the error in the given program for the simple interest
#include<stdio.h>
Void main()
{
float prin,noy,roi,intrst;
printf(“enter principle\n”);
scanf(“%f”, &prin);
printf(“enter number of years\n”);
scanf(“%f”, &noy);
printf(“enter the rate of intrst\n”);
scanf(“%f”, &roi);
intrst=(prin+noy+roi)/100;
printf(“\n intrst%7.2*f”, intrst);
a) logic b) syntax c) both d) no error
Ans: a) logic (logic is (prin*noy*roi)/100
141.Write the output of the following
n =7;
printf(“%d%d%d”, n++, n, n--);
a) 787 b) 667 c) 778 d) 887
Ans; d) 887
158.Is it true that too many recursive calls may result into stack overflow?
a.yes
b.no
c.none
ans yes
159.the maximum combined length of the command line arguments including the
spaces between adjacent arguments is
a. 128 characters
b. 256 characters
c. 67 characters
d. It may vary from one operating system to another.
Ans 256 characters
Answer=A
Ans=B
answer=B
177. C language is
A. middle level language
B. high level language
C. low level language
D.none
Ans=A
In the above declaration data type of ptr is______ and data type of
variable pointed by ptr is______.
(x) Float,int
Ans :- (iv);pointer,float
191.Last character of a string is-
(ix) 0
(x) \0
(xi) \n
(xii) End
Ans :- (ii); \0
192.When we use string functions such as strlen(), strrev() etc. Then must
include file –
(ix) #include<string.h>
(x) #include<iostream.h>
(xi) #include<fstream.h>
(xii) #include<iostring.h>
(ix) Public
(x) Protected
(xi) Private
Ans :- (iii),private
194.When a member function is defined inside the class, then it is treated
as a ____ function-
(ix) Inline
(x) Outline
(xi) External
(xii) Virtual
196. the output of following program if i is stored at the memory location, 1000 is
#include<stdio.h.>
#include<conio.h>
void main()
{
int i=3,*j,**k;
j=&i;
k=&j;
printf(“%d”,**k);
getch();
}
a)1000,
b)1002,
c)3,
d)1003.
Answer- c
• Both can occur multiple times, but a declaration must occur first.
• There is no difference between them.
• A definition occurs once, but a declaration may occur many times.
• A declaration occurs once, but a definition may occur many times.[Ans]
• Both can occur multiple times, but a definition must occur first.
209.int a=10,b;
b=a++ + ++a;
printf("%d,%d,%d,%d",b,a++,a,++a);
what will be the output when following code is executed?
• 22,10,11,13
• 22,11,11,11
• 12,11,11,11
• 22,13,13,13[Ans]
• Machine
• Procedural[Ans]
• Assembly
• Object-oriented
• Strictly-typed
211.In a C expression, how is a logical AND represented?
• @@
• ||
• .AND.
• && [Ans]
• .AND
212.According to the Standard C specification, what are the respective minimum sizes
(in bytes) of the following three data types: short; int; and long?
• 1, 2, 2
• 1, 2, 4
• 1, 2, 8
• 2, 2, 4[Ans]
• 2, 4, 8
ans:b
216.C IS A
a)middle laevel language
b)high level language
c)low level language
d)none of these
ans:d
Ans:no difference except for the fact that first one gives a hint that the function fun() is probably
in another source file.
b. d. none of these
ans.c
223. The header file required by the standard input/output
library function is _________
a.iostream.h
b.stdio.h
c.conio.h
d. none of these
ans b
224.The operation of “\b” stands for
a. New line
b. Horizontal line
c. Previous line
d. Backspace
ans d.
229. A do..while loop is useful when we want the statements within the loop to be executed
a. at least once
b. once only
c. more than once
d. none
Ans: at least once
231. The max no. of bytes that a ‘float’ data type can occupy is/are
a. 1
b. 4
c. 8
d. 2
Ans: 4
a A float
b A double
c A long double
d Depending upon the memory model that you are using
Answer- b A double
Main( )
{
Extern int fun(float);
Int a;
A= fun(3.14);
Printf(“%d”,a);
}
Int fun(aa)
Float aa;
{
Return( (int) aa)
}
a. 3
b. 3.14
c. 0
d. Error
Answer d.error
239.can we use a switch statement to switch on strings?
Answer. No
Main( )
{
Int i=3;
I=i++
Printf(“%d”,i)
}
Answer. 4
Main( )
{
Int i=2;
Printf(“\n%d%d”,++I,++i);
}
ans.2
250.which of following are ternary operater
1.?,:
2.!
3.&&,”
4.none of these
ans.1
251.pick the odd one out
1.a=a+1
2.a+=1
3.a++
4.a=+1
ans.4
252.Which of the following is not the language?
a) C b) c++ c) COBOL d) Compiler
ans.: d) Compiler
258.Bugs means
A)logic error B)syntax error C)Both A & B D) testing of error
Ans= C
261.ASCII value of \0 is
A) 1 B)48 C)0 D)100
Ans= C
280.C is a
E) Middle level language
F) High level language
G) Low level language
H) None of the above
Ans:D
285.int is denoted by
A)%c b)%d c)% d)%f
Ans—c
286.float is denoted by
a)%c b)%d c)%a d)%f
ans-d
a.2.5
b.3
c.2
d.0 (ans: c )
294.A ‘do while’ statement is useful when we want the statement within for loopmust be
executed
1.at least once
2.Only once
3.More than once
4.None of above
Ans.1
Ans=1.
Ans- b
Ans-b
Ans-b
315.To print out a&b given below,which printf() statement would you use ?
Float a=3.14;
Double b=3.14;
a)printf(“%f%f”,a,b);
b) printf(“%Lf%f”,a,b);
c) printf(“%Lf%Lf”,a,b);
d) printf(“%f%Lf”,a,b);
Ans-a
Ans-b)
Ans-d)
ans: b
Ans-c
ans:d
321.C programs are converted into machine language with the help of
A. interpreter B. compiler C. operating system D. none
Correct ans. B
ANS- ii
343..Maximum number of bytes that a long double data type can occupy is
a.4
b.2
c.8
d.10
345.Maximum number of files that can be occupied by float that ‘float’ data type can be occupied
in memory is
a.1
b.2
c.3
d.4
ANS: 4
348. C programs are converted into machine langauge with the help of
a.) An Editor
b.) A compiler
c.) An operating system
d.) None of these
ans--b.) A compiler
349. The real constant in C can be expressed in which of the following forms
a.) Fractional form only
b.) Exponential form only
c.) ASCII for only
d.) Both a.) and b.)
ans--c.)1972
352.)Which of the following is allowed in a C Arthmetic instruction
a.) [ ]
b.) { }
c.) ( )
d.) None of the above
ans--c.) ( )
ans--d.)3+a=b
ans----b.)printf
ans--b.) #else if
358.)If character strings is to be recieved through the keyboard,which function would work
faster?
a.) scanf()
b.) gets()
c.) printf()
d.) None of the above
ans--a.) scanf()
361.)If an interger is to be entered through the keyboard,which function would you use?
a.) scanf()
b.) getche()
c.) gets()
d.)getchar()
ans--a.) scanf()
362.Float*ptr :
In the above declaration data type of ptr is______ and data type of
variable pointed by ptr is______.
(xiv) Float,int
(xiii) 0
(xiv) \0
(xv) \n
(xvi) End
Ans :- (ii); \0
364.When we use string functions such as strlen(), strrev() etc. Then must
include file –
(xiii) #include<string.h>
(xiv) #include<iostream.h>
(xv) #include<fstream.h>
(xvi) #include<iostring.h>
(xiii) Public
(xiv) Protected
(xv) Private
Ans :- (iii),private
366When a member function is defined inside the class, then it is treated
as a ____ function-
(xiii) Inline
(xiv) Outline
(xv) External
(xvi) Virtual
ANS 3
368.GCD MEANS
1.GREATER COMMON DIVISER
2.GREATER COMMON FACTOR
3.BOTH A B
4.NONE OF THESE
ANS 1
ANS 2
370.I/O FUNCTION IS
A. PRINTF
B.SCANF
C.BOTH
D.NONE
ANS C
ANS 1
379) Do-while loop is useful when we want that statement within loop must be executed:
1. Only once
2. At least once
3. More than once
4. None of these
Ans: Only once
383.A do-while loop is useful when we want that the statement within the loop must be
executed-
a) Only once
b) At least once
c) More than once
d) None
Ans:b)
384.Which of the following is the program design tool that is a visual presentation of the
logic in function-
a) Flow-chart
b)Structure chart
c)Water fall model
d)None
Ans:a)
388.C program can be converted into machine language with the help of
an interpreter
a compiler
an operating system
none
Ans=b
391.the computer language that most closely resembles with the machine language is
a)assembly
b) cobol
c) fortran
d) high level languge
Ans= a
ANS=a
400.Which of the following statement is false
ANS=a
Ans : (2)
409.,in what sequence the initialization , testing and executionof 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
Ans: (3)
410. Which of the following statement is used to take control to the beginning of the loop
(1) Exit
(2) Break
(3) Continue
(4) None of the above
Ans : (3)
411. When you pass an array as an argument to a function what actually gets passed ?
(1) Address of the array
(2) Values of the element
(3) Address of the first element
(4) Number of the element in array
Ans : (1)
(f) 8 chatacters
(b) 32767
(c) 1.7014e+38
(d) -1.7014e+38
ANS=b
421 A function is identified by an open parenthesis following
(a) a keyword
(b) an identifier other than keywords
(c) an identifier including keywords
(d) an operator
ANS = b
ANS=a
ANS=a
430 If u don’t initialize a static array, what will be the elements set to?
A. 0 B. an undetermined value
B. a floating pt. no. D. character constant ‘\0’
Correct ans. A
432.C programs are converted into machine language with the help of
B. interpreter B. compiler C. operating system D. none
Correct ans. B
ans. B
ans. D
Ans: d)
ans: a)
446.C programs are converted into machine language with the help of
C. interpreter B. compiler C. operating system D. none
ans. B
447.If you don't initialise a static array, what will be the element set to?
a.) 0
b.) an undetermined value
c.) a floating point number
d.) the character cinstant '/0'
ans--a.) 0
ans--a.) 32 bits
ans--b.)8088
452.MS-DOS is a
a.) Single user operating system
b.) Multi user operating system
c.) Multi tasking operating system
d.) None of the above
454.The option used to execute same loop again and again for finite no. of times is….
a) then loop b)for loop c)both a
&b d)none of these
ans: b) for loop
455.int is denoted by ……
a) “%d” b) “%f” c)”%s”
d)none of these
ans: a) “%d”
504.The option used to execute same loop again and again for finite no. of times is….
a) then loop b)for loop c)both a
&b d)none of these
ans: b) for loop
505.int is denoted by ……
a) “%d” b) “%f” c)”%s”
d)none of these
ans: a) “%d”
511.If u don’t initialize a static array, what will be the elements set to?
A. 0 B. an undetermined value
E. a floating pt. no. D. character constant ‘\0’
Correct ans. A
516. C programs Are converted into machine level language with the
help of:
1)Interpreter
2)Compiler
3)Operating System
4)None of these
ans: 2)
520.A ‘do while’ statement is useful when we want the statement within for loopmust be
executed
1.at least once
2.Only once
3.More than once
4.None of above
Ans.1
521.What is difference between 5’s in this expression?
Int[5]
Num[5]
1.first is particular element&second isarray size
2.first isarray size &second is particular element
3.both specify arrays & their sizes
4.both specify int type elements
Ans.2
523.If u don’t initialize a static array, what will be the elements set to?
A. 0 B. an undetermined value
F. a floating pt. no. D. character constant ‘\0’
Correct ans. A
526.The option used to execute same loop again and again for finite no. of times is….
a) then loop b)for loop c)both a
&b d)none of these
ans: b) for loop
528. The smallest element from unsorted sublist and swaps in with element at beginning of
unsorted data is found by following sort-
(a) bubble (b) exchange (c) insertion (d) quick (e) selection
ANS:{a).
538.C programs are converted into machine language with the help of
a.An editor b.A compiler
c.An operating system d. none
ans:b
539.A character variable can at a time store
a.one character b.8 characters
c.254 character d. none
ans:a
540.If a is an integer variable,a=5/2; will return a value
a.2.5 b.3
c.2 d.0
ans:c
541.Which of the followig is odd one out
a.+ b.-
c./ d.**
ans:d
542.A do while loop is useful when we want that the statements within the loop
must be executed:
a.only once b.At least once
c.more than once d.none
ans:b
548.C programmes are converted into machine language with the help of
a.A neditor b.A compiler
c.An operating system d.None of the above
ans.b
549.What is a function?
a.datatype b.array
c.use defined operation d.predefined operation
ans.c
550.The last chor of every string is
a.integer b.chor
c.float d.null char
ans.d
551.Which of the following not a high language?
a.cobol b.fortran
c.assembly d.basic
ans.c
552 Which of the following is noy a loop of control string
a.while b.to
c.do while d.for
ans.b
1)input/output
2)start/stop
3)computation
4)sub routine
Ans:-3
559.’c’ is developed by
1)einstien
2)Newton
3)graham bell
4)dennis Ritchie
Ans:-4
560.part of function is
1)return type
2)paramet list
3)body of function
4)all of above
Ans:-4
561.‘‘+=’symbol is presented by
1)bitwise or
2)bitwiseand
3)assign sum
4)assignment
Ans:-3
562.input and output string can be handled by
1)scanf ( )
2)printf()
3)%cformat specifier
4)all of above
Ans:-4
563.syntax for for loop is--
A) for (initialize variable; testing; increment/decrement)
B) for (initialize variable; increment/decrement; testing)
C) for (initialize variable; testing; increment/decrement);
D) for(testing; increment/decrement; initialize variable)
ANS) A
A) 2.5
B) 3
C) 2
D) error
ANS) C