Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 22 pages
Exam (elaborations)

Programming Languages: Final Exam Review Guide/ Qs & Ans/ .

Document preview thumbnail
Preview 3 out of 22 pages

Programming Languages: Final Exam Review Guide/ Qs & Ans/ .

Content preview

Programming Languages: Final Exam
Review Guide/ Qs & Ans/ 2024-2025.
Strong typing and weak typing. Static typing and dynamic typing. (Examples.
Why). - Answer: Strong Typing - a language is said to be strongly typed if it
prohibits, in a way that the language implementation can enforce, the application
of any operation to any object that is not intended to support that operation to
any object that is not intended to support that operation. (e.g., Java, C++,) Ruby is
strongly typed because once it knows the type of an object, it expects you to do
something that makes sense with it.
Ex:
x = "3"
y = x + "ho!"
#=> "3ho!"


but

,x = "3"
y=x+3
will produce an error.
------------------------------------------Weak Typing - a language that is being lenient
about what you can do with your typed variables. Javascript, however, is
dynamically but weakly typed because it lets you mix types together in your
expressions without throwing an exception. The danger? If you're not careful you
will get weird results.
----------------------------------------
Statically Typing - a language is said to be statically typed if it is strongly typed and
type checking can be performed at compile time.language has a type system that
is checked at compile time by the implementation (a compiler or interpreter) and
it is strongly typed. (e.g. Ada, Pascal, Lisp)
------------------------------------------
Dynamic Typing - Dynamic type checking is a form of late binding, and tends to be
found in languages that delay other issues until run time as well. (e.g., Python,
Ruby, Lisp)


Some languages have both static and dynamic type checking.
- Pascal, Java etc are mostly static typing.
- Python, PHP, and most script languages are dynamic typing.
- C++ are combined (support dynamic casting)

, Reference variables and value variables. - Answer: Reference Variable - It provides
an alias (alternative name) for a previously defined variable. References cannot be
null because every reference refers to some object.
Ex: int foo;
int& bar = foo;
bar is now a reference which means that bar holds the location of memory where
foo lies.


Value Variable -
d = a;
a = b + c;
In the first statement, the right hand side of the statement refers to the value of a,
which we wish to place into d. In the second statement, the left hand side refers
to the location of a, where we want to put the sum of b and c.


•Variables as values vs. variables as references
-value-oriented languages
•C, Pascal, Ada
-reference-oriented languages
•most functional languages (Lisp, Scheme, ML) •Clu, Smalltalk
-Algol-68 kinda halfway in-between -Java deliberately in-between
•built-in types are values •user-defined types are objects - references

Document information

Uploaded on
June 25, 2024
Number of pages
22
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
$23.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Studyresource1
4.6
(709)
Sold
7252
Followers
24
Items
1365
Last sold
2 weeks ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions