# GATE Questions

Q:

What is the difference between stack and array?

Stack:

- Stack is a ordered collection of items

- Stack is a dynamic object whose size is constantly changing as items are pushed and popped .

- Stack may contain different data types

Array:

- Array is an ordered collection of items

- Array is a static object i.e. no of item is fixed and is assigned by the declaration of the array

- It contains same data types.

Subject: C++ - Technology Exam Prep: GATE

4602
Q:

There are three rooms in a Hotel: one single, one double and one for four persons. How many ways are there to house seven persons in these rooms ?

 A) 105 B) 7! x 6! C) 7!/5! D) 420

Explanation:

Choose 1 person for the single room & from the remaining choose 2 for the double room & from the remaining choose 4 people for the four person room,

Then, 7C1 x 6C2 x 4C4
= 7 x $\inline \fn_jvn \small \frac{6x5}{2}$ x 1
= 7 x 15 = 105.

8 2942
Q:

What was the day of the week on 17th June, 1998 ?

 A) Monday B) Tuesday C) Wednesday D) Friday

Explanation:

17th June, 1998 = (1997 years + Period from 1.1.1998 to 17.6.1998)
Odd days in 1600 years = 0
Odd days in 300 years = 1
97 years has 24 leap years + 73 ordinary years.
Number of odd days in 97 years ( 24 x 2 + 73) = 121 = 2 odd days.
Jan. Feb. March. April. May. June.
(31 + 28 + 31 + 30 + 31 + 17) = 168 days
168 days = 24 weeks = 0 odd day.
Total number of odd days = (0 + 1 + 2 + 0) = 3.
Given day is Wednesday.

10 2244
Q:

Every year before the festive season, a brand store increases the price of the product by 42% and then introduce two successive discount of 10% and 11% respectively. What is percentage loss and percentage gain ?

 A) 3.25% loss B) 13.742% loss C) 3.25% gain D) 13.742% gain

Explanation:

Let CP = 100,
42 % increase => SP = 142
10 % discount in SP => ((142 x 10)/100) = 14.2
So 1st SP = (142 - 14.2) = 127.8, again 12 % discount in 1st SP ((127.8 x 11)/100) = 14.058
2nd SP = (127.8 - 14.058) = 113.742,
So finally CP = 100, SP = 113.742, => gain = 13.742%.

3 1761
Q:

Which among the following are not the c++ tokens

 A) Identifiers B) keywords C) Strings D) None

Explanation:

All the above listed options are c++ tokens .They  include:

- keywords

- Identifiers

- Constants

- Strings

- operators