Posts

Showing posts with the label MCQ

head is a pointer to the head of a linked list of points that is built. How do you access the member x of the head node of the list?

Image
    head is a pointer to the head of a linked list of points that is built. How do you access the member x of the head node of the list?   struct point{ int x,y; }; typedef struct point Point; struct ptlist{ Point pt; struct ptlist* next; }; struct plist *head;   A. head >pt >x B. head >pt.x C. Both are equivalent D. Both are incorrect Answer. B) A pointer to a structure lets access to the member variables using “ >” operator and a normal variable lets access through the “.” operator.

MCQ TYPES

Image
    1. What would happen if main() { main(); } is executed. A. Compile time error. B. The program will run forever and has to be manually terminated. C. The stack would overflow and eventually the program will be killed by the operating system. D. main() executes only once. Answer : C It executes until there is overflow in the call stack. 2. In a function, what is the maximum number of return statements possible A. 1 B. 2 C. 4 D. None of the above Answer : D There is no restriction to the number of returns statements in a program. 3. What will be the output of the following program? #include <stdio.h> void demo(); int main() { void (*fun)(); fun = demo; (*fun)(); fun(); return 0; } void demo() { printf("India "); } A. India B. India India C. India India India D. Compiler Error Answer : B This is a simple program with function pointers. fun is assigned to point to demo. So the two statements “(*fun)();” and “fun();” mean the same thing. 4. Express the return value of fun...

Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?

Image
    Assume that a mergesort algorithm in the worst case takes 30 seconds for an input of size 64. Which of the following most closely approximates the maximum input size of a problem that can be solved in 6 minutes?   (A) 256 (B) 512 (C) 1024 (D) 2048 Answer: (B) Explanation: Time complexity of merge sort is Θ(nLogn) c*64Log64 is 30 c*64*6 is 30 c is 5/64 For time 6 minutes 5/64*nLogn = 6*60 nLogn = 72*64 = 512 * 9 n = 512.

You are given a set of n points on the number line. They are given in arbitrary order. The task is to find the points that are closest to each other.

Image
    You are given a set of n points on the number line. They are given in arbitrary order. The task is to find the points that are closest to each other. To solve the problem you decide to take one point and compute its distance to all other points and repeat this process for all points. During the process you track the closest pair. What is the running time of this algorithm ?   O(nlgn) O(n^2) Runtime is independent of n. O(log n)   The answer is B  .

AMCAT Verbal Ability Important Questions Part 2 | AMCAT Preparation | AMCAT Details

Image
    AMCAT Verbal Ability Important Questions Part 2 | AMCAT Preparation | AMCAT Details    Q. The crops are drying, (it must not had) rained. a.) must had not b.)must not be c.)must not have d.)must not have been e.)No correction required Answer: c) Q. Find grammatical error: (A) jahu beach in mumbai was filled with (B) immunerable people. who had gathered there (C) to see the discovered newly ancient temple. a.(A) b.(B) c.(C) d.none Answer: c) Q. Correct the error Because of his ill health, the doctor has advised him (not to refrain) from smoking.   a.) to not refrain from b.)to resort to c.)to refrain from d.)to be refrained from e.)No correction required. Answer: c)   Q. Usually the room tariff in this hotel is higher. At present,it is low because of the------- season. a.peak b.off c.down d.slow e.full Answer: b) Q. Choose correct one: I always wanted a basket ball and ------- I-pad in my collection. a.T...

Accenture Aptitude Questions and Answers | Numerical Ability

Image
    Accenture Aptitude Questions and Answers | Numerical Ability   This article contains the latest Accenture Aptitude Questions and Answers, asked in the Numerical Ability section of Stage 1 Online Aptitude Test. If you're preparing to take on Accenture Recruitment any time soon, this is a must-read.   Q1.   Find the value of | x+2 - | 2x-3 || at x = 3. A. 10 B. 3 C. 2 D. 1 Answer:   Option C Q2.   In a city ABC, the population of males decreased by 8% from 2018 to 2019. If the male population in 2018 was 7200, then find the male population in 2019. A. 6580 B. 6435 C. 7420 D. 6624 Answer:   Option D Q3.  Anthony purchased two dozen oranges at $12 per dozen and three dozen oranges at $18 per dozen. Find the average cost per dozen of the oranges that he purchased. A. $16.2 B. $16.8 C. $15.6 D. $15.8 Answer:   Option C Q4.   Lincoln can complete a task in 12 days, Joshua can complete it in 18 days. Chris can complete the same task in ...