Chapter 1 Flashcards
What is a programming language?
What are the different levels of programming languages?
hardware > machine language > assembly language > high-level language
What is a programming paradigm?
basic assumptions, ways of thinking, or methodologies that are commonly accepted by members of a group or community
Give four examples of programming paradigms.
object-oriented, imperative, logic, and functional
How is a program written in machine language?
How are machine language instructions processed by the CPU?
Is it possible to have conditions and loops in code written in machine language?
no
How is a program written in assembly language different from a program written in machine language?
machine language is composed of 1’s and 0’s only
assembly language uses characters and numbers
Is code written in assembly language executed in sequential order?
What is needed to execute a program in assembly language?
an assembler
What is the function of an assembler?
What are the three elements that every single high-level programming language is able to handle?
All high-level programming languages require that a variable be defined with a specific data type. (T or F)
What is the function of a compiler?
Is the compiler the one running the program?
no
How did punch cards work? (bonus)
What are the registers in the CPU? How do they play a role in the execution of instructions in a computer? (bonus)
When a value is stored in a variable, what actually happens in the computer? Where is it stored and how does the computer refer to the place it is stored?
Are there languages that support more than one paradigm?
yes
Give two examples of object-oriented programming languages.
C++ and Java
What is the programming paradigm of Scheme?
functional?
What is the key idea of procedural programming?
What is the key idea of object-oriented programming?
What is the key idea of functional programming?
What is the key idea of logic programming?
What are the main features of procedural programming?
What are the main features of object-oriented programming?
What are the main features of functional programming?
What are the main features of logic programming?
Inheritance is a feature of imperative programming. (T or F)
F
Instance variables are available in imperative programming. (T or F)
What is a language?
What is a high-level programming language?
What is a low-level programming language?
Is Java low-level or high-level?
high-level
What does object-oriented programming mean?
What is an operator?
What is a lexical rule?
What is a syntactic rule?
What is a semantic rule?
What is a lexical error?
What is a syntactical error?
Give an example of a lexical rule in Java.
Give an example of a syntactical rule in Java.
int $ = 1;
Is this sentence correct on the lexical, syntactical, and semantics level in Java?
lexical = yes
syntactical =
semantics =
int x = ‘a’;
Is this sentence correct on the lexical, syntactical, and semantics level in Java?
lexical = yes
syntactical = yes
semantics = yes
for(;;);
Is there a syntactical error in this sentence in Java?
no
Does a lexical error cause a syntactical error?
Does a syntactical error cause a lexical error?
12938102&qwerty-1a1a1a/xyzw(;}”aaa999;
(written in Java)
How many words are there?
Are there any lexical errors?
Are there any syntactical errors?
2, no, yes
int Int = 0xFF-.7/7.;
(written in Java)
How many words are there?
Are there any lexical errors?
Are there any syntactical errors?
1, no, yes
What is a compiler?
What is an assembler?
What is a linker?
What is object code?
What is an interpreter?
What does portability mean?
What does it mean when a compiler + a virtual machine are used to process a program?
What does it mean when a compiler + compiler are used to process a program?
What is intermediate code?
What is the main advantage of using an interpreter over using a compiler?
What is the main advantage of using a compiler over an interpreter?
What are the primitive data types?
int, float, double, char, void
What types are not primitive?
array, structure, union, enum
How do objects, arrays, and primitive variables look in the memory?
Where are primitive global variables stored in the memory?
Where are primitive local variables stored in the memory?
Where are non-primitive global variables stored in the memory?
Where are non-primitive local variables stored in the memory?
What is a reference?
What is the heap?
What is the stack?
What is stack overflow?
What is the size of an int (in bytes)?
4
What is the size of a long (in bytes)?
8
What is the size of a float (in bytes)?
4
What is the size of a double (in bytes)?
8
What is a variable?
Why does a variable need a data type?
Is Java a weakly-typed or strongly-typed language?
strongly-typed
What is casting?
What is coercion?
What is structural equivalence?
What is name equivalence?
Does Java apply structural equivalence for non-primitive data?
Does Java apply name equivalence for non-primitive data?
Which language has strong-type checking?
Java
C
C++
Java
C++?
Which language has weak-type checking?
Java
C
C++
C