Solved

Question about functions

Posted on 2004-04-08
2
292 Views
Last Modified: 2010-04-17
Please can someone answer on these 3 questions. I looked everywhere and could not find the answer.

1. Which of these statements is false?
a) Arrays can be passed using a call by reference using reference parameters
b) Structures can be passed using a call by reference using reference parameters
c) Structures cannot be passed using a call by value
D. Enumerated data variables cannot be passed in a call by reference using pointers


2. If a variable (such as float distance;) is declared in driver.cpp, how can it be seen in a different file (such as train.cpp)?
a) declare float distance globally in driver.cpp only
b) declare float distance globally in driver.cpp and declare extern float distance in Train.cpp
c) declare another float distance variable in Train.cpp
d) #include float distance in Train.cpp


3. Which one is a feature of the C++ programing language that is not a feature of the C programming language?
a) pass by reference using pointers
b) enumerated data types
c) pass by reference using reference parameters
d) both B and C


Thank you so much,
alkanc
0
Comment
Question by:alkanc
2 Comments
 

Accepted Solution

by:
Kronuz earned 30 total points
ID: 10787879
1. c
arrays, structures and enums can be passed by reference using reference parameters or pointers. Arrays are the only data type that can't be passed by value. The correct answer is C.

2. b
in the first case you would have the variable declared in the Driver.cpp, but not in Train.cpp. If you declare another variable in Train.cpp you would have two instances of two different float varibles. If you include the Train.cpp you would end up with duplicated declarations. The correct answer is B.

3. c
you can use pointers to pass data by reference, and there are enums on ANSI C, but you can't pass data by reference using reference parameters, which are new for C++. The correct answer is C.
0
 

Author Comment

by:alkanc
ID: 10788054
Thank you very, very much.
alkanc
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is about my first experience with programming Arduino.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question