Correcting answers

Discussion in 'C++' started by Richard, Dec 12, 2005.

  1. Richard

    Richard Guest

    Can any one correct these true and false answer for me? I did not but I
    don't know if they are all corrected. THanks

    True. In C++, resersed words the same as predefined identifiers.



    False. An indentifier can be any sequence of digits, leters, and the
    underscore.



    True. When trying to store a double value in an int variable, the double
    value is rounded to the nearest interger.



    False. An if statement cannot be nested in a switch statement, but a switch
    statement can be nested in an if statement.



    True. The execution of a break statement in a while loop terminates the
    loop.



    True. A function definition consists of the function heading and the body of
    the function.



    True. Parameters allow the programmer to use different values each time the
    functions is called.



    False. The execution of the return statement in a user-defined function
    terminates the program.



    True. It is not necessary to specify the names of formal parameters in a
    function prototype.



    False. The return statement



    Return x +1;

    First returns the values of x and then increments the values of
    x.



    True. The following return statement return the value 10.

    Return 10,16;



    True. The following statement in a value-returning function is legal.(
    assume that all variables are properly declared)

    If (x%==0)

    Return x;

    Else

    Return x +1;



    True. Given the function prototype



    Float test();

    The statement

    Cout<<test;

    Is legal because the function test has no parameters.



    True. Given the function prototype

    Double testAlpha (int u, char v, double t);

    The following statement is legal.

    Cout<<testAlpha(5, 'A', 2);



    False. If a formal parameters is a value parameter and the corresponding
    actual parameters is a variable, the actual parameter can be modified.



    False. If an ampersand, & is attached to the data type of a formal
    parameter, the corresponding actual parameter must be a variable.



    True. A value parameter only changes its own content without changing the
    value of the actual parameter.



    True. A variable name can be passed to a value parameter.



    False. The corresponding actual parameter for a reference parameter can be
    any expression



    True. Any parameter the receives a value and also sends a value outside the
    function must be declared as reference parameter.



    True. If a formal parameter is a reference parameter, the corresponding
    actual parameter must be a varialble



    True. The pass by value mechanism must be used if the calling code is to
    receive values back from the function.



    True. A variable declared outside of every block is called a global
    variable.



    True. In a program global constants have no side effects.



    False. The scope of a formal parameter and the scope of a local variable
    declared in the outer block of a function body is the same



    True. In C++, function definitions cannot be nested, that is, the definition
    of one function cannot be enclosed in the body of another function.



    True. A static variable works the same way as global variable because memory
    for the static variables remains allocated during program execution.



    True. The following is a legal C++ function definition

    Void funcTest(int& u, double& v);

    {

    Cout<<u<<" "<<v<<endl;

    }

    False. The output of the C++ code

    Int alpha =5;

    Int beta=10;

    Alpha = alpha +5;

    {

    Int alpha;

    Alpha=20;

    beta= beta +5;



    }

    Cout<<alpha<<" "<<beta<<endl;



    Is: 10 15



    True. In C++ , when declaring an array as a formal parameter, the size of
    the array must be specified within square brackets.



    True. The word const is used before the array declaration in a function
    heading to prevent the function from modifying the array.



    False. A struct can be passed as a parameter to a function by value or by
    reference.



    True. A function cannot return a value of a type struct



    True. The Address operator is a urary operator that returns the address of
    its operand.



    True. Any number can be directly assigned to a pointer variable.
    Richard, Dec 12, 2005
    #1
    1. Advertising

  2. Richard wrote:
    > Can any one correct these true and false answer for me? I did not but I


    I don't understand your statement "I did not but I don't know ..."

    > don't know if they are all corrected. THanks
    > [...]


    And, no, we don't do homeworks.

    V
    Victor Bazarov, Dec 12, 2005
    #2
    1. Advertising

  3. Richard

    Howard Guest

    "Richard" <> wrote in message
    news:...
    > Can any one correct these true and false answer for me? I did not but I
    > don't know if they are all corrected. THanks
    >
    > True. In C++, resersed words the same as predefined identifiers.
    >
    >
    >
    > False. An indentifier can be any sequence of digits, leters, and the
    > underscore.
    >
    >


    1) How coud we possibly know if the answers are correct, when you haven't
    given the questions???

    2) If this is some kind of homework, we don't do that here.

    3) A lot of what you've written is badly misspelled and/or makes no sense.
    This first "answer" is a good example: "resersed words the same as
    predefined identifiers". What does that mean?

    -Howard
    Howard, Dec 12, 2005
    #3
  4. Richard

    Howard Guest

    "Howard" <> wrote in message
    news:eTgnf.270973$...
    >
    > "Richard" <> wrote in message
    > news:...
    >> Can any one correct these true and false answer for me? I did not but I
    >> don't know if they are all corrected. THanks
    >>
    >> True. In C++, resersed words the same as predefined identifiers.
    >>
    >>
    >>
    >> False. An indentifier can be any sequence of digits, leters, and the
    >> underscore.
    >>
    >>

    >
    > 1) How coud we possibly know if the answers are correct, when you haven't
    > given the questions???
    >


    Hmm... I guess those _are_ the questions, and the answers are the true/false
    you give before them? Very odd way of listing the questions and answers in
    that case...

    -Howard
    Howard, Dec 12, 2005
    #4
  5. Richard

    Earl Purple Guest

    Richard wrote:
    > Can any one correct these true and false answer for me? I did not but I
    > don't know if they are all corrected. THanks


    <snip>

    C++ is a case-sensitive language, but your post breaks the rules
    several times. For example a return statement must use a lower-case
    'r'.
    Earl Purple, Dec 12, 2005
    #5
  6. Earl Purple wrote:
    > Richard wrote:
    >
    >>Can any one correct these true and false answer for me? I did not but I
    >>don't know if they are all corrected. THanks

    >
    >
    > <snip>
    >
    > C++ is a case-sensitive language, but your post breaks the rules
    > several times. For example a return statement must use a lower-case
    > 'r'.
    >


    Actually it must use *two* lower-case 'r's.

    V
    Victor Bazarov, Dec 12, 2005
    #6
  7. Richard

    dave Guest

    "Richard" <> wrote in message
    news:...
    > Can any one correct these true and false answer for me? I did not but I
    > don't know if they are all corrected. THanks
    >
    > True. In C++, resersed words the same as predefined identifiers.


    FALSE
    >
    >
    > False. An indentifier can be any sequence of digits, leters, and the
    > underscore.


    FALSE

    >
    >
    >
    > True. When trying to store a double value in an int variable, the double
    > value is rounded to the nearest interger.
    >

    TRUE
    >
    >
    > False. An if statement cannot be nested in a switch statement, but a

    switch
    > statement can be nested in an if statement.


    FALSE
    >
    >
    >
    > True. The execution of a break statement in a while loop terminates the
    > loop.
    >

    TRUE
    >
    >
    > True. A function definition consists of the function heading and the body

    of
    > the function.
    >

    TRUE
    >
    >
    > True. Parameters allow the programmer to use different values each time

    the
    > functions is called.
    >

    TRUE
    >
    >
    > False. The execution of the return statement in a user-defined function
    > terminates the program.
    >

    FALSE
    >
    >
    > True. It is not necessary to specify the names of formal parameters in a
    > function prototype.
    >

    TRUE
    >
    >
    > False. The return statement
    >


    >
    >
    > Return x +1;
    >
    > First returns the values of x and then increments the values

    of
    > x.
    >

    FALSE
    >
    >
    > True. The following return statement return the value 10.
    >
    > Return 10,16;
    >


    FALSE
    >
    >
    > True. The following statement in a value-returning function is legal.(
    > assume that all variables are properly declared)
    >
    > If (x%==0)
    >
    > Return x;
    >
    > Else
    >
    > Return x +1;
    >
    >

    FALSE
    >
    > True. Given the function prototype
    >
    >
    >
    > Float test();
    >
    > The statement
    >
    > Cout<<test;
    >
    > Is legal because the function test has no parameters.

    FALSE
    >
    >
    >
    > True. Given the function prototype
    >
    > Double testAlpha (int u, char v, double t);
    >
    > The following statement is legal.
    >
    > Cout<<testAlpha(5, 'A', 2);
    >

    TRUE
    >
    >
    > False. If a formal parameters is a value parameter and the corresponding
    > actual parameters is a variable, the actual parameter can be modified.
    >

    FALSE
    >
    >
    > False. If an ampersand, & is attached to the data type of a formal
    > parameter, the corresponding actual parameter must be a variable.
    >

    TRUE
    >
    >
    > True. A value parameter only changes its own content without changing the
    > value of the actual parameter.
    >

    TRUE
    >
    >
    > True. A variable name can be passed to a value parameter.
    >

    TRUE
    >
    >
    > False. The corresponding actual parameter for a reference parameter can be
    > any expression
    >

    FALSE
    >
    >
    > True. Any parameter the receives a value and also sends a value outside

    the
    > function must be declared as reference parameter.
    >

    FALSE
    >
    >
    > True. If a formal parameter is a reference parameter, the corresponding
    > actual parameter must be a varialble
    >


    TRUE
    >
    >
    > True. The pass by value mechanism must be used if the calling code is to
    > receive values back from the function.
    >

    FALSE
    >
    >
    > True. A variable declared outside of every block is called a global
    > variable.
    >

    TRUE
    >
    >
    > True. In a program global constants have no side effects.
    >

    FALSE
    >
    >
    > False. The scope of a formal parameter and the scope of a local variable
    > declared in the outer block of a function body is the same
    >

    FALSE
    >
    >
    > True. In C++, function definitions cannot be nested, that is, the

    definition
    > of one function cannot be enclosed in the body of another function.
    >

    TRUE
    >
    >
    > True. A static variable works the same way as global variable because

    memory
    > for the static variables remains allocated during program execution.
    >
    >

    FALSE
    >
    > True. The following is a legal C++ function definition
    >
    > Void funcTest(int& u, double& v);
    >
    > {
    >
    > Cout<<u<<" "<<v<<endl;
    >
    > }

    TRUE
    >
    > False. The output of the C++ code
    >
    > Int alpha =5;
    >
    > Int beta=10;
    >
    > Alpha = alpha +5;
    >
    > {
    >
    > Int alpha;
    >
    > Alpha=20;
    >
    > beta= beta +5;
    >
    >
    >
    > }
    >
    > Cout<<alpha<<" "<<beta<<endl;
    >
    >
    >
    > Is: 10 15
    >

    FALSE
    >
    >
    > True. In C++ , when declaring an array as a formal parameter, the size of
    > the array must be specified within square brackets.
    >

    TRUE
    >
    >
    > True. The word const is used before the array declaration in a function
    > heading to prevent the function from modifying the array.
    >

    FALSE
    >
    >
    > False. A struct can be passed as a parameter to a function by value or by
    > reference.
    >

    FALSE
    >
    >
    > True. A function cannot return a value of a type struct
    >

    FALSE
    >
    >
    > True. The Address operator is a urary operator that returns the address of
    > its operand.
    >

    TRUE
    >
    >
    > True. Any number can be directly assigned to a pointer variable.
    >

    FALSE
    >
    dave, Dec 12, 2005
    #7
  8. Richard

    W Marsh Guest

    On Mon, 12 Dec 2005 12:46:10 -0500, Victor Bazarov
    <> wrote:

    >Earl Purple wrote:
    >> Richard wrote:
    >>
    >>>Can any one correct these true and false answer for me? I did not but I
    >>>don't know if they are all corrected. THanks

    >>
    >>
    >> <snip>
    >>
    >> C++ is a case-sensitive language, but your post breaks the rules
    >> several times. For example a return statement must use a lower-case
    >> 'r'.
    >>

    >
    >Actually it must use *two* lower-case 'r's.
    >
    >V


    So THAT'S why my source wouldn't compile:

    retuRn someValue;
    }

    DOH!
    W Marsh, Dec 12, 2005
    #8
  9. Richard

    Jay Nabonne Guest

    On Mon, 12 Dec 2005 12:52:07 -0500, dave wrote:

    >> True. When trying to store a double value in an int variable, the double
    >> value is rounded to the nearest interger.
    >>

    > TRUE


    AFAIK, it rounds towards zero (truncates). So, FALSE.

    - Jay
    Jay Nabonne, Dec 12, 2005
    #9
  10. Jay Nabonne wrote:
    > On Mon, 12 Dec 2005 12:52:07 -0500, dave wrote:
    >
    >
    >>>True. When trying to store a double value in an int variable, the double
    >>>value is rounded to the nearest interger.
    >>>

    >>
    >>TRUE

    >
    >
    > AFAIK, it rounds towards zero (truncates). So, FALSE.


    It depends on the CPU mode. It is usually programmable as well. IOW,
    it's implementation- and system-specific and the default value of the
    'round_style' is 'round_toward_zero' for generic 'numeric_limits'
    template, but can be 'round_to_nearest' for 'float', as the example on
    page 340-341 shows.

    V
    Victor Bazarov, Dec 12, 2005
    #10
  11. Richard

    Jay Nabonne Guest

    On Mon, 12 Dec 2005 12:52:07 -0500, dave wrote:

    >
    > "Richard" <> wrote in message
    > news:...
    >>
    >>
    >> True. The execution of a break statement in a while loop terminates the
    >> loop.
    >>

    > TRUE


    Usually. But:

    while (!done)
    {
    for (int i = 0; i < 10; ++i)
    {
    if (i == 3)
    break;
    }
    }

    Is the break statement considered "in the while loop"?

    >>
    >> True. Given the function prototype
    >>
    >>
    >>
    >> Float test();
    >>
    >> The statement
    >>
    >> Cout<<test;
    >>
    >> Is legal because the function test has no parameters.

    > FALSE


    Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    address of the function test. It will work even if the function has
    parameters. (Of course, it will not actually invoke the function in any
    case without parens.)

    >>
    >>
    >> False. If an ampersand, & is attached to the data type of a formal
    >> parameter, the corresponding actual parameter must be a variable.
    >>

    > TRUE


    Unless it's const (e.g. "const int &"), in which case it can be bound to a
    temporary.

    >>
    >>
    >> True. If a formal parameter is a reference parameter, the corresponding
    >> actual parameter must be a varialble
    >>

    >
    > TRUE


    Same as before - unless it's const.

    >>
    >> True. The following is a legal C++ function definition
    >>
    >> Void funcTest(int& u, double& v);
    >>
    >> {
    >>
    >> Cout<<u<<" "<<v<<endl;
    >>
    >> }

    > TRUE


    FALSE. The trailing semi-colon on the "funcTest" line results in a syntax
    error.

    >>
    >>
    >> True. In C++ , when declaring an array as a formal parameter, the size of
    >> the array must be specified within square brackets.
    >>

    > TRUE


    FALSE.

    int main(int argc, char* argv[])
    {
    }

    >>
    >>
    >> True. The word const is used before the array declaration in a function
    >> heading to prevent the function from modifying the array.
    >>

    > FALSE


    TRUE. (What else would the const do?)

    >>
    >>
    >> False. A struct can be passed as a parameter to a function by value or by
    >> reference.
    >>

    > FALSE


    TRUE.

    struct Point { int x, y; }

    void myFunc(Point inp, Point& outp);


    - Jay
    Jay Nabonne, Dec 12, 2005
    #11
  12. Richard

    Jay Nabonne Guest

    On Mon, 12 Dec 2005 13:44:36 -0500, Victor Bazarov wrote:

    > Jay Nabonne wrote:
    >> On Mon, 12 Dec 2005 12:52:07 -0500, dave wrote:
    >>
    >>
    >>>>True. When trying to store a double value in an int variable, the double
    >>>>value is rounded to the nearest interger.
    >>>>
    >>>
    >>>TRUE

    >>
    >>
    >> AFAIK, it rounds towards zero (truncates). So, FALSE.

    >
    > It depends on the CPU mode. It is usually programmable as well. IOW,
    > it's implementation- and system-specific and the default value of the
    > 'round_style' is 'round_toward_zero' for generic 'numeric_limits'
    > template, but can be 'round_to_nearest' for 'float', as the example on
    > page 340-341 shows.
    >


    That's good to know. Thanks!
    Jay Nabonne, Dec 12, 2005
    #12
  13. Richard

    Guest

    Richard wrote:
    > True. The following return statement return the value 10.
    >
    > Return 10,16;


    FALSE

    Spelling error aside (return), the return value will be 16.
    Quote from the C++ Standard (2003):

    Sect. 5.18 P. 1 - "A pair of expressions separated by a comma is
    evaluated left-to-right and the value of the left expression is
    discarded."

    Cheers,
    Andre
    , Dec 12, 2005
    #13
  14. Jay Nabonne <> schrieb:

    >>> Float test();
    >>> The statement
    >>> Cout<<test;
    >>> Is legal because the function test has no parameters.

    >> FALSE

    >
    > Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    > address of the function test. It will work even if the function has


    So the answer 'FALSE' is right, because it is not legal because of
    no parameters, but because of 'missing' parentheses(sp?).

    >>> True. The following is a legal C++ function definition
    >>>
    >>> Void funcTest(int& u, double& v);
    >>> {
    >>> Cout<<u<<" "<<v<<endl;
    >>> }

    >> TRUE

    >
    > FALSE. The trailing semi-colon on the "funcTest" line results in a syntax
    > error.


    Actually, it is the '{' following the ';' which triggers an error.
    Up to the ';' it is a forward declaration.

    >>> True. The word const is used before the array declaration in a function
    >>> heading to prevent the function from modifying the array.


    What is an 'array declaration' in a 'function heading'?

    >> FALSE

    >
    > TRUE. (What else would the const do?)


    Give a hint to the compiler, that the function won't.
    BTW: you can cast the 'const' away ...

    Markus
    Markus Becker, Dec 12, 2005
    #14
  15. Richard

    Jay Nabonne Guest

    On Mon, 12 Dec 2005 23:28:09 +0100, Markus Becker wrote:

    > Jay Nabonne <> schrieb:
    >
    >>>> Float test();
    >>>> The statement
    >>>> Cout<<test;
    >>>> Is legal because the function test has no parameters.
    >>> FALSE

    >>
    >> Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    >> address of the function test. It will work even if the function has

    >
    > So the answer 'FALSE' is right, because it is not legal because of
    > no parameters, but because of 'missing' parentheses(sp?).
    >


    The answer "TRUE" is right.

    Simplistically, to me "legal" means "a compilable, runnable program". The
    program as is will compile and run. It just won't do what I believed the
    person creating the question meant it would do (it prints out the address
    of the function instead of invoking it). But there's nothing illegal about
    it. It's a question of desired effect. Someone could quite easily want to
    do the above in a debugging situation.

    So, the program is completely LEGAL (regardless of how many params the
    function has). But it *may* also be INCORRECT. But that wasn't the
    question...

    >>>> True. The following is a legal C++ function definition
    >>>>
    >>>> Void funcTest(int& u, double& v);
    >>>> {
    >>>> Cout<<u<<" "<<v<<endl;
    >>>> }
    >>> TRUE

    >>
    >> FALSE. The trailing semi-colon on the "funcTest" line results in a syntax
    >> error.

    >
    > Actually, it is the '{' following the ';' which triggers an error.
    > Up to the ';' it is a forward declaration.


    You are correct. I guess I should have more clearly said "The trailing
    semi-colon on the "funcTest" line results in a *subsequent* syntax error."

    Since the question stated this was supposed to be a definition (not a
    declaration), I assumed the semi-colon was the erroneous part, not the
    block following.

    >
    >>>> True. The word const is used before the array declaration in a function
    >>>> heading to prevent the function from modifying the array.

    >
    > What is an 'array declaration' in a 'function heading'?


    e.g.

    void PrintData(int const data[], int size)
    {
    for (int i = 0; i < size; ++i)
    {
    printf("%d\n", data); // OK
    data = 0; // BAD. const object
    }
    }

    >
    >>> FALSE

    >>
    >> TRUE. (What else would the const do?)

    >
    > Give a hint to the compiler, that the function won't.
    > BTW: you can cast the 'const' away ...


    Thanks. That was a rhetorical question to the previous caller. ;)

    >
    > Markus
    Jay Nabonne, Dec 13, 2005
    #15
  16. Richard

    Old Wolf Guest

    Richard wrote:

    > Can any one correct these true and false answer for me? I did not but I
    > don't know if they are all corrected. THanks


    I counted 17 right out of 33 -- did you flip a coin?
    Old Wolf, Dec 13, 2005
    #16
  17. Jay Nabonne wrote:
    >
    > On Mon, 12 Dec 2005 23:28:09 +0100, Markus Becker wrote:
    >
    > > Jay Nabonne <> schrieb:
    > >
    > >>>> Float test();
    > >>>> The statement
    > >>>> Cout<<test;
    > >>>> Is legal because the function test has no parameters.
    > >>> FALSE
    > >>
    > >> Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    > >> address of the function test. It will work even if the function has

    > >
    > > So the answer 'FALSE' is right, because it is not legal because of
    > > no parameters, but because of 'missing' parentheses(sp?).
    > >

    >
    > The answer "TRUE" is right.
    >
    > Simplistically, to me "legal" means "a compilable, runnable program". The
    > program as is will compile and run.


    Right.
    But the predefined answer also gave a reason why that should be legal.
    And that reason is wrong. Thus the answer to the whole question must be:
    False.

    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Dec 13, 2005
    #17
  18. Richard

    Jay Nabonne Guest

    On Tue, 13 Dec 2005 10:09:06 +0100, Karl Heinz Buchegger wrote:

    > Jay Nabonne wrote:
    >>
    >> On Mon, 12 Dec 2005 23:28:09 +0100, Markus Becker wrote:
    >>
    >> > Jay Nabonne <> schrieb:
    >> >
    >> >>>> Float test();
    >> >>>> The statement
    >> >>>> Cout<<test;
    >> >>>> Is legal because the function test has no parameters.
    >> >>> FALSE
    >> >>
    >> >> Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    >> >> address of the function test. It will work even if the function has
    >> >
    >> > So the answer 'FALSE' is right, because it is not legal because of
    >> > no parameters, but because of 'missing' parentheses(sp?).
    >> >

    >>
    >> The answer "TRUE" is right.
    >>
    >> Simplistically, to me "legal" means "a compilable, runnable program". The
    >> program as is will compile and run.

    >
    > Right.
    > But the predefined answer also gave a reason why that should be legal.
    > And that reason is wrong. Thus the answer to the whole question must be:
    > False.


    Given that, I agree.

    As an aside, somehow I doubt the person giving these questions thought
    about it to this extent. I hope it wasn't a teacher that came up with
    the above "problem".

    - Jay
    Jay Nabonne, Dec 13, 2005
    #18
  19. Jay Nabonne wrote:
    >
    > >
    > > Right.
    > > But the predefined answer also gave a reason why that should be legal.
    > > And that reason is wrong. Thus the answer to the whole question must be:
    > > False.

    >
    > Given that, I agree.
    >
    > As an aside, somehow I doubt the person giving these questions thought
    > about it to this extent. I hope it wasn't a teacher that came up with
    > the above "problem".


    I bet it was a teacher :)

    --
    Karl Heinz Buchegger
    Karl Heinz Buchegger, Dec 13, 2005
    #19
  20. Richard

    Greg Herlihy Guest

    On 12/12/05 5:04 PM, in article
    , "Jay Nabonne"
    <> wrote:

    > On Mon, 12 Dec 2005 23:28:09 +0100, Markus Becker wrote:
    >
    >> Jay Nabonne <> schrieb:
    >>
    >>>>> Float test();
    >>>>> The statement
    >>>>> Cout<<test;
    >>>>> Is legal because the function test has no parameters.
    >>>> FALSE
    >>>
    >>> Perfectly *legal* (mis-casing of "cout" ignored). It prints out the
    >>> address of the function test. It will work even if the function has

    >>
    >> So the answer 'FALSE' is right, because it is not legal because of
    >> no parameters, but because of 'missing' parentheses(sp?).
    >>

    >
    > The answer "TRUE" is right.
    >
    > Simplistically, to me "legal" means "a compilable, runnable program". The
    > program as is will compile and run. It just won't do what I believed the
    > person creating the question meant it would do (it prints out the address
    > of the function instead of invoking it). But there's nothing illegal about
    > it. It's a question of desired effect. Someone could quite easily want to
    > do the above in a debugging situation.
    >
    > So, the program is completely LEGAL (regardless of how many params the
    > function has). But it *may* also be INCORRECT. But that wasn't the
    > question...


    The answer to the question being asked is "FALSE".

    We know that the code is legal, the question tells us that "cout<<test" is
    legal.

    We are to decide whether the reason that the code is legal is due to the
    fact that test() takes no parameters. Since the code would still be legal if
    test did take one or more parameters, the number of parameters that test()
    accepts could not be the explanation for why the the code compiles. So the
    answer is "FALSE".

    The actual reason the code is legal is for the reasons already provided
    above.

    Greg
    Greg Herlihy, Dec 13, 2005
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wilq
    Replies:
    0
    Views:
    1,343
  2. MCP
    Replies:
    11
    Views:
    1,073
    Andrew Thompson
    Jun 11, 2004
  3. Sheldon
    Replies:
    13
    Views:
    579
    Scott David Daniels
    Oct 5, 2006
  4. zotkara

    Newbie needs help correcting code

    zotkara, Jan 3, 2006, in forum: C Programming
    Replies:
    25
    Views:
    630
    Randy Howard
    Jan 3, 2006
  5. vv1
    Replies:
    1
    Views:
    427
    T.M. Sommers
    Nov 6, 2006
Loading...

Share This Page