Tuesday, 9 August 2016

C & C++ Programming Multiple Choice Questions - Set 13

1.       Seek time is ...............
(A) time taken to retrieve a data
(B) time taken by read/write head mechanism to position itself over appropriate cylinder
(C) time taken by appropriate sector to come under read/write
(D) time taken to find out the data
Answer: B
2.       Latency time is ...................
(A) time taken by read/write head mechanism to position itself over appropriate cylinder
(B) time taken to transfer a data from memory
(C) time taken by appropriate sector to come under read/write head
(D) time taken to retrieve the data
Answer: C
3.       If and the switch statements are called as ................. statements.
(A) iteration                   (B) jump
(C) selection                 (D) conditional
Answer: C
4.       The conditional expressions are evaluated from .............
(A) top down     (B) bottom up
(C) middle         (D) end
Answer: A
5.       What is the output of the following program?
main ( )
{ extern int x;
x = 20;
printf(“\n%d”, x);
}
(A) 0                   (B) 20
(C) error             (D) garbage value
Answer: C
Explanation:
Output of the given program will be “Linker error-undefined symbol x”. External variables are declared outside a function.

6.       What is the output of the following program segment?
main()
{
int i = 1;
do
{ printf(“%d..”, i);
} while(i--);
}
(A) 0..1..             (B) 1..0..
(C) 0                   (D) -1
Answer: B
7.       What is the output of the following program segment?
main()
{
int i = ++2;
printf(“%d\n”, i);
}
(A) 3       (B) 2
(C) 0       (D) -1
Answer: A
Explanation:
It is a compilation error. However if we write “i=2; ++i;” then value of i is printed as 3.
8.       Output of the program given below is
int i;
main()
{
printf(“%d”, i);
}
(A) 1       (B) 0
(C) -1      (D) Null
Answer: B
9.       What will be the output of the following program ?
main()
{
char *p = “ayqm”;
printf (“%c”, ++*(p++));}
(A) b       (B) z
(C) q       (D) n
Answer: A
10.    What is a Constructor?
(A) A function called when an instance of a class is initialized.
(B) A function that is called when an instance of a class is deleted.
(C) A special function to change the value of dynamically allocated memory.
(D) A function that is called in order to change the value of a variable.
Answer: A


0 comments:

Post a Comment

UGC NET Computer Science

Computer GK App