
Learn core concepts, essential formulas, and attempt practice questions designed on the latest TCS NQT testing patterns.
If a program runs as './a.out file.txt 10', what is argc?
Correct Answer: A) 3
Step-by-step Solution: Arguments are: argv[0]='./a.out', argv[1]='file.txt', argv[2]='10'. Total count = 3.
What is stored in argv[0]?
Correct Answer: A) Program executable path/name
Step-by-step Solution: argv[0] holds the execution path or name of the compiled program.
Command-line arguments are always read into argv as strings. Convert them to numbers using atoi() if needed.