Solved

Question about functions

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SPLUNK REST  API call to Splunk to create and index? 2 101
count7 challenge 12 101
Looking for example pivot year code used in Y2K 4 61
C Programming - If Statement 8 72
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
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 …

911 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

22 Experts available now in Live!

Get 1:1 Help Now