Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What will be the output of the program (sample.c) given below if it is executed from the command line (Turbo C in DOS)? cmd>

Answer» Here argv[1], argv[2] and argv[3] are string type. We have to convert the string to integer type before perform arithmetic operation. Example: j = atoi(argv[1]) + atoi(argv[2]) + atoi(argv[3]);
2.

In Turbo C/C++ under DOS if we want that any wild card characters in the command-line arguments should be appropriately expanded, are we required to make any special provision?

Answer» Yes you have to compile a program liketcc myprog wildargs.obj
3.

Does there exist any way to make the command-line arguments available to other functions without passing them as arguments to the function?

Answer» Using the predefined variables _argc, _argv. This is a compiler dependent feature. It works in TC/TC++ but not in gcc and visual studio.