Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Question about functions

Posted on 2004-04-08
2
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Accepted Solution

by:
Kronuz earned 120 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Simple Linear Regression

650 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