# 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

4059
Q:

Explain fork() system call?

The `fork()’ used to create a new process from an existing process. The new process is called the child process, and the existing process is called the parent. We can tell which is which by checking the return value from `fork()’. The parent gets the child’s pid returned to him, but the child gets 0 returned to him.

Subject: Operating Systems Exam Prep: GATE

1341
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

Filed Under: C++ - Technology
Exam Prep: GATE

2 1298
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.

4 1253
Q:

What is the output of this program?

class main_arguments {
public static void main(String [ ] args)
{
String [][] argument = new String[2][2];
int x;
argument[0] = args;
x = argument[0].length;
for (int y = 0; y < x; y++)
System.out.print(" " + argument[0][y]);
}
}

 A) 1 1 B) 1 0 C) 1 0 3 D) 1 2 3

Explanation:

In argument[0] = args;, the reference variable arg[0], which was referring to an array with two elements, is reassigned to an array (args) with three elements.
Output:
\$ javac main_arguments.java
\$ java main_arguments
1 2 3