Verizon India Placement Test C language skills test questions:

These questions are from the technical interview test for Verizon India recruitment exam, also see other C language practise test multiple choice and tech interview questions

* C programming language:

* How do you write a program which produces its own source code as its output?

* How can I find the day of the week given the date?

* Why doesn?t C have nested functions?

* What is the most efficient way to count the number of bits which are set in a value?

* How can I convert integers to binary or hexadecimal?

* How can I call a function, given its name as a string?

* How do I access command-line arguments?

* How can I return multiple values from a function?

* How can I invoke another program from within a C program?

* How can I access memory located at a certain address?

* How can I allocate arrays or structures bigger than 64K?

* How can I find out how much memory is available?

* How can I read a directory in a C program?

* How can I increase the allowable number of simultaneously open files?

* What?s wrong with the call ?fopen(?c:\newdir\file.dat?, ?r?)??

VERIZON PAPER AT CHENNAI

1). Two trains are on the same track a distance 300 km apart heading towards one another, One at a speed of 150 km/h and other at a speed of 50 km/h. A fly starting out at the front of one train, flies towards the other at a speed of 600 km/h. Upon reaching the other train, the fly turns around and continues towards the first train. How many kilometers does the fly travel before getting squashed in the collision of the two trains?

2). You have to measure exactly 4 liters of water, but you only have a 3-liter bottle and a 5-liter bottle. How do you do it?

Sol:-

Method 1:

1. Take 5 lit water and pour it into 3 lit mug.

2. Pour 3 lit mug water outside.

3. Transfer 2 lit water from 5 lit mug to 3 lit mug.

4. Now take 5 lit water and pour 1 lit into 2 lit water.

Then we remain 4 lit water in 5 lit mug.

Method 2:

1. Fill the 3-liter bottle and pour it into the empty 5-liter bottle.

2. Fill the 3-liter bottle again, and pour enough to fill 5-liter bottle. This leaves exactly1 liter in the 3-liter bottle.

3. Empty the 5-liter bottle; pour the remaining 1 liter from the 3-liter bottle into the 5-liter bottle.

4. Fill the 3-liter bottle and pour it into the 5-liter bottle. The 5-liter bottle now has exactly 4 liters.

3). You have 9 balls,equally big,equally heavy-except for one, which is a little heavier.How would you identify the heavier ball if you could use a pair of balance scales only twice?

Sol:-

Divide the 9 balls into 3 groups of 3. Compare the weight of two of those groups. The heavier group should then be obvious, it will either tip the scales, or, if the scales stay balanced, then it is the group you didn't include.

Now, choose 2 balls from this group and compare their weights, and using the same logic as before, the heavier ball will be obvious.

4). Some statistics questions regarding correlation and expectation of life time of a bulb.