Solved

Question about functions

Posted on 2004-04-08
2
286 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

776 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