Solved

Question about functions

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
how to open Waze.com/livemap from address saved in DB? 26 152
nestparen challenge 4 56
firstChar challenge 13 84
base64 decode encode 12 97
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now