Geschreven door studenten die geslaagd zijn Direct beschikbaar na je betaling Online lezen of als PDF Verkeerd document? Gratis ruilen 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CS3307 Final UPDATED ACTUAL Exam Questions and CORRECT Answers

Beoordeling
-
Verkocht
-
Pagina's
108
Cijfer
A+
Geüpload op
31-08-2025
Geschreven in
2025/2026

CS3307 Final UPDATED ACTUAL Exam Questions and CORRECT Answers similarity between procedural and object-oriented programming - CORRECT ANSWER There is a very similar control flow between procedure and object-oriented programming. Very similar call-and-return mechanisms, in one case using procedures and in the other using methods on classes and objects. difference between procedural and object-oriented programming - CORRECT ANSWER The key distinction is that procedural languages organize by procedures with data and functionality separate (though sometimes loosely collected into modules), whereas object-oriented languages organize by classes and objects, with data and functionality effectively bundled togeth

Meer zien Lees minder
Instelling
CS3307
Vak
CS3307

Voorbeeld van de inhoud

CS3307 Final UPDATED ACTUAL Exam
Questions and CORRECT Answers
similarity between procedural and object-oriented programming - CORRECT
ANSWER There is a very similar control flow between procedure and object-oriented
programming. Very similar call-and-return mechanisms, in one case using procedures and in the
other using methods on classes and objects.


difference between procedural and object-oriented programming - CORRECT
ANSWER The key distinction is that procedural languages organize by procedures with
data and functionality separate (though sometimes loosely collected into modules), whereas
object-oriented languages organize by classes and objects, with data and functionality effectively
bundled together


Benefits of object-oriented programming: Modularization - CORRECT ANSWER ->
Refers to the design approach where a software application is implemented as a collection of
independent units (subsystems) that communicate by exchanging only the absolutely necessary
information (data) that is required to perform an operation
-> In other words, they have low coupling
-> Furthermore, each unit (subsystem) performs a specific operation or a collection of very
closely related operations
-> In other words, they have high cohesion
-> Usually, a collection of related classes constitutes a subsystem


Object orientation is not the solution to every programming need - CORRECT
ANSWER Data base applications -> SQL, 4GLs
Embedded systems -> Assembly, .....


Why C++? - CORRECT ANSWER -> C++ is the fourth most popular programming
language according to the latest TIOBE index for 2019, behind Java, C, and Python
-> It is often praised for generally doing a good job of merging the benefits of object-orientation
with the power and speed of C

,-> Its template library provides a decent collection of starting points, and add-on packages like
Boost take things even further
-> Mastering C++ will also make you a better programmer at C, Java, C# and many other
languages - approaching things the other way is significantly more challenging


Why not C++? - CORRECT ANSWER -> C++ lacks garbage collection and forces users
to manage memory on their own (though some people see this as a plus)
-> C++ lacks some high level language features like reflection (Reflection: program asking
questions (eg. Checking objects type))
-> Templates, while beneficial, are still harder to use and more error prone than they should be in
practice
-> Some recent developments in the language are perceived as feature creep and unnecessary


Entire programs in C++ can be written using only regular functions not defined in any class -
CORRECT ANSWER ; in other words, classes are not mandatory



explain std::cout - CORRECT ANSWER Std:: reffering to namespace which is collection
of methods and objects. Std::cout Want to use cout stream of the std space


Instead of using std::endl you can use - CORRECT ANSWER \n



using namespace std; - CORRECT ANSWER Allows you to use cout and end1 without
std::


5 steps to building c++ program - CORRECT ANSWER multiple source files, C++
compiler (g++), Multiple object files, Linker (Id), executable


how to build in one step in command line - CORRECT ANSWER > g++ HelloWorld.cpp
-o HelloWorld
> ./HelloWorld

,How to build in multiple steps in command line - CORRECT ANSWER > g++ -c
HelloWorld.cpp
> g++ HelloWorld.o -o HelloWorld
> ./HelloWorld


#define constants - CORRECT ANSWER preprocessor definitions that do a simple
replacement during preprocessing and before compiling
ex. #define PI 3.14


const constants - CORRECT ANSWER named constant declarations where the
programmer commits to not changing a value, and this promise is enforced by the compiler
ex. const double pi = 3.14;


constexpr constants - CORRECT ANSWER constant expressions evaluated at compile
time, allowing them to be placed in read-only memory or to improve performance (new in
C++11) ex. constexpr double radius1 = 5.0;


(possible to calculate the value at compile time lets say there is function to add 2 numbers, we
can calculate that at compile time because it is not like the input numbers we are adding are from
user input)


Function in C++ have thing diff from functions in C - CORRECT ANSWER Optionally,
one or more modifiers designating special behaviour of the function or modifying how the
compiler treats or compiles it (this is where things can get ugly and deviate from C ...)
Modifer: how function is called, how its executed, allows you to have optimization.


Dont need to name parameters - CORRECT ANSWER when declaring a function but will
name when defined void swap (int *, int *);


Function Definition - CORRECT ANSWER A function definition is a function declaration
alongside a presentation of the body of the function

, Function Parameter:
What about our swap function though?
Recall that it exchanges the values in the two variables pointed to by its parameters!

Does this not break the pass by value rules? - CORRECT ANSWER Passed pointers to
stack frame but they pointed to the heap and manipulated the variables which is why it is fine.


C++ also allows parameters to be passed by reference by designating them with an - CORRECT
ANSWER & in the function declaration. The variable in the function definition is not a
local variable in this case, but rather an alias to the variable outside of the function and passed
into it as a parameter
As a result, changes in value within the function propagate outside the function as well
Only use pass by reference when this behaviour is necessary, otherwise things can get rather
confusing!


const - CORRECT ANSWER is a commitment to not modify something and so the
compiler will treat it as a constant and not let us modify it


3 ways function can exit - CORRECT ANSWER -> It executes a return statement,
providing a return value of the appropriate type (or not providing anything in the case of a void
function)
-> Reaching the end of the function body, which is only allowed in void functions or main(), in
which case this indicates successful completion
-> Calling a system function that does not return (like exit())


Function Modifiers: inline - CORRECT ANSWER The compiler should try to embed the
code for the function where it is called from, typically for performance reasons. copy and paste
the code every spot that is is called so you have the modularity of the function but have
performance of it being in the spot. Use inline for functions that are small and called often.


Function Modifiers: constexpr - CORRECT ANSWER The compiler should evaluate the
results of calling the function at compile time, making this usable with constexpr constants.

Geschreven voor

Instelling
CS3307
Vak
CS3307

Documentinformatie

Geüpload op
31 augustus 2025
Aantal pagina's
108
Geschreven in
2025/2026
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$15.49
Krijg toegang tot het volledige document:

Verkeerd document? Gratis ruilen Binnen 14 dagen na aankoop en voor het downloaden kun je een ander document kiezen. Je kunt het bedrag gewoon opnieuw besteden.
Geschreven door studenten die geslaagd zijn
Direct beschikbaar na je betaling
Online lezen of als PDF


Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
De reputatie van een verkoper is gebaseerd op het aantal documenten dat iemand tegen betaling verkocht heeft en de beoordelingen die voor die items ontvangen zijn. Er zijn drie niveau’s te onderscheiden: brons, zilver en goud. Hoe beter de reputatie, hoe meer de kwaliteit van zijn of haar werk te vertrouwen is.
MGRADES Stanford University
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
1372
Lid sinds
2 jaar
Aantal volgers
103
Documenten
84394
Laatst verkocht
2 uur geleden
MGRADES (Genius Brains)

Welcome to MGRADES Exams, practices and Study materials The work speaks for itself Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3.8

229 beoordelingen

5
93
4
50
3
51
2
14
1
21

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo makkelijk kan het dus zijn.”

Alisha Student

Bezig met je bronvermelding?

Maak nauwkeurige citaten in APA, MLA en Harvard met onze gratis bronnengenerator.

Bezig met je bronvermelding?

Veelgestelde vragen