5.127 · exercise

Basic quiz: command-line arguments

How the words typed after a program's name reach main: argc, the argv array of string addresses, and atoi, which turns an argument into a number.

0 of 6 correct

Multiple choice

A program is started as ./greet "good morning" Sam. What is argc?

Multiple choice

On entry to main, which register holds argv, and what is it?

Multiple choice

x20 holds argv. Which instruction loads argv[1], the address of the first argument's text?

Multiple choice

A program is run as ./scale 25. What does argv[1] point at?

Multiple choice

Which library function turns the text "250" into the int 250 and returns it in w0?

Multiple choice

What does the entry argv[argc] hold?