Question: A C++ program named examProg that has been coded to accept command-line arguments is run at the Unix command line as follows: z1234567@turing:~$ ./examProg data.txt

A C++ program named examProg that has been coded to accept command-line arguments is run at the Unix command line as follows:

z1234567@turing:~$ ./examProg data.txt 20 3

What will be the value of the parameter argv[2]?

A.

The integer value 20

B.

The C string "20"

C.

The C string "./examProg"

D.

The C string "data.txt"

Assume that we have the following C++ program:

#include

using namespace std;

int num = 10;

int sum(int, int);

int main()

{

int x = 3, y = 5;

cout << sum(x, y) + num << endl;

return 0;

}

int sum(int a, int b)

{

return (a + b);

}

What is the storage class of the variable a?

A.

automatic storage

B.

static storage

C.

dynamic storage

QUESTION 12

  • Assume that we have the following C++ program: #include
  • using namespace std;
  • int num = 10;
  • int sum(int, int);
  • int main()
  • {
  • int x = 3, y = 5;
  • cout << sum(x, y) + num << endl;
  • return 0;
  • }
  • int sum(int a, int b)
  • {
  • return (a + b);
  • }
  • What is the scope of the variable num?

.

. A.

. class scope

.

. B.

. file scope

.

. C.

. function scope

.

. D.

. block scope

. Answer all please

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!