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)

CS 326 - comprehensive final exam

Beoordeling
-
Verkocht
-
Pagina's
31
Cijfer
A
Geüpload op
13-05-2025
Geschreven in
2024/2025

CS 326 - comprehensive final exam

Instelling
CS 326
Vak
CS 326

Voorbeeld van de inhoud

CS 326 - final exam



Generate a Grammar that is Syntactically Valid, but show an input string that would not type
check.



(test question from subprograms slide part 2) - e = expression

f = factor



start -> e ';'

e -> e +/- f | f

f -> f */ / atom

| atom

atom -> string

| int



"Bob" / 26 ; //could be valid string if you want it to be

it is syntactically valid but semantically drugs.



What is "auto-boxing" - Conversion between primitive types and the corresponding wrapper
classes is automatic.



ie. int a = 10;

Integer b = a; //Auto boxing (int to Integer)

int c = b; // Unboxing (Integer to int)



ie.

Primitive Data Types:

,These are the basic data types in Java such as 'int' , 'double', 'char', and 'boolean'. They are not
objects and do not belong to any class. They are stored efficiently and have a lower memory
footprint.



Wrapper Classes: for every primitive data type in Java, there is a corresponding wrapper class,
like 'Integer' for 'int', 'Double' for 'double', 'Character' for 'char', and 'Boolean' for 'boolean'.
These classes encapsulate the primitive data type in an object allowing them to be used in
places where only objects can be utilized.



Auto Boxing - is the process where the Java compiler automatically converts the primitive type
into its corresponding wrapper class object. For example, when you type int, to an Integer
object, Java automatically converts the int to an Integer.



Unboxing the reverse process called unboxing, where the object of a wrapper class is converted
back to a primitive type



What is the potential negative about "auto boxing" in relation to Java?



Think int -> Integer



(Lec 10.19.23) Subprograms 3 - Has to be an object because Java weaves it into the bytecode
that way. Under the hood, when calling a generic, the generic is called an object type. Thus, it
has to be that way or the program does not work - mathematically required. The problem is
objects are generally bigger and slower. Instead of using ALU - you have to make an object to
put in a variable which all takes time.. size of object + heap + field of actual 32 bits and
something to access (getter/setter/caller) which all takes up some space.

,Generic is called



The syntax of a programming language is?'



ref ch 3 - The form of its expressions, statements, and program units.



The semantics of a programming language is?



ref ch 3 - The meaning of those expressions, statements, and programming units.



Why are syntax and semantics closely related?



ref ch 3 - A well-designed programming language, semantics should follow directly from syntax;
that is, the appearance of a statement should strongly suggest what the statement is meant to
accomplish.



Strings of a language are called? - sentences or statements.



What are Lexemes?



ref ch 3 - lowest-level of syntactical units. They include its numeric literals, operators, and
special words, etc.



One can think of programs as strings of lexemes rather than characters



What are Identifiers?

, ref Ch 3 - Identifiers - when partitioned into groups (ie. names of variables, classes, etc)



What are Tokens?



ref ch 3 - Each lexeme group that is represented by a name or token. So, a token of a language is
a category of its lexemes.



What is a grammar?



ref ch 3 - Grammars are formal language-generation mechanisms. They commonly are used to
describe the syntax of a programming language



Who created Context-Free Grammars?



ref ch 3 - Noam Chomsky



Who created BNF?



ref ch 3 - John Backus and Peter Naur



What is BNF?



ref ch 3 - It is a natural notation for describing syntax.



What is a meta-language?

Geschreven voor

Instelling
CS 326
Vak
CS 326

Documentinformatie

Geüpload op
13 mei 2025
Aantal pagina's
31
Geschreven in
2024/2025
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$6.79
Krijg toegang tot het volledige document:

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

Maak kennis met de verkoper
Seller avatar
StudyMastermind

Ook beschikbaar in voordeelbundel

Thumbnail
Voordeelbundel
cs 326
-
2 2025
$ 12.78 Meer info

Maak kennis met de verkoper

Seller avatar
StudyMastermind Teachme2-tutor
Bekijk profiel
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
10 maanden
Aantal volgers
0
Documenten
208
Laatst verkocht
-
Study Mastermind

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Populaire documenten

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 Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

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

Alisha Student

Veelgestelde vragen