EXAM 1 Topics Flashcards

1
Q

What is a high level language?

A

A programming language that is designed to be easy for humans to read and write. Are used to write software that can be understood by humans and computers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a low level languages?

A

They are closer to machine languages and are harder for humans to read and write. Are used to write programs that interact directly with the computers hardware.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a mid level language?

A

Serves as a bridge between high level and low level languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are language paradigms?

A

Are a way to classify programming languages based on their features. Used to describe the style of syntax and grammar, the way the code is organized and the implications for the execution model of the language. FUNCTIONAL, IMPERATIVE,OBJECT ORIENTED

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is object oriented programming?

A

OOP, is a programming paradigm that is based on the concept of object. An object is a self contained entity that consists of both data and methods that operate on that data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is machine language?

A

A low level programming language that is used to represent operations and fata in a machine. (binary)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the four pillars of OOP?

A

Encapsulation, Abstraction, Inheritance, Polymorphism

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is encapsulation?

A

Is the process of hiding the implementation details of an object from the outside world. Is done to protect the objects integrity and to prevent unauthorized access to its internal state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is abstraction?

A

Is the process of simplifying complex systems by breaking them down into smaller, more manageable parts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is inheritance?

A

Is the process of creating new classes from existing classes. The new classes inherit the properties and methods of the existing classes, which can then be modified or extended as needed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is polymorphism?

A

Is the ability of objects to take on many forms. Is achieved through method overloading and method overriding.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the steps of translation from c code to machine code?(Program translation)

A

Preprocessing, Compiling, Assembling, Linking,Loader

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do you compile the file hello.c?

A

$ gcc -std=c99 -Wall -Wextra -pedantic -c hello.c
$ gcc -o hello hello.o

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the -Wall flag do?

A

It enables all warning messages that the compiler can generate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the -c flag do?

A

This flag tells the compiler to compile the source code into an object file, but not to link it with other object files to create an executable program.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the -o flag do?

A

This flag specifies the name of the output file that the compiler should generate.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does the -std=c99 flag do?

A

It is used to specify the version of the C standard that the program that the program should be compiled against. Used to determine the language standard.

18
Q

What does the -Wextra and -pedantic flag do?

A

It is a warning option in the gcc compiler that enables supplementary warnings beyond those enabled by -Wall. Used to enable extra warning flags that are not included in -Wall.

19
Q

What does the #define preprocessor do?

A

It defines macros, which are used to store constants.

20
Q

What does #include preprocessor do?

A

Is used to include a header file in a C program. It tells the preprocessor to include the contents of a header file in the source code of the program.

21
Q

What is a header file?

A

Files that contain declarations of functions, variables, and other constructs that are used in the program.

22
Q

What does the preprocessor #ifndef do?

A

It is used to check if a macro has not been defined before. If the macro has not been defined, the code between the preprocessor and the corresponding #endif directive is included in the program. Is often used to prevent multiple inclusions of header files in a program.

23
Q

What does preprocessor #endif do?

A

Is used to mark the end of a conditional block of code that began with an #if, #ifdef, or #ifndef directive. It is used to tell the preprocessor where the conditional block of code ends.

24
Q

What are the primitive data types in c?

A

Are the most basic data types that are used for representing simple values. Int, float, double, char, void.

25
Q

What is a user define data type?

A

Are defined by the user themselves. Such as structures and unions.

26
Q

How to set up a pointer?

A

First declare a pointer variable.
data_type *pointer_name;
ex: int *ptr;
This declares a pointer variable named ptr that points to an integer.
After declaring the pointer variable you can assign it to the adress of a variable using the address of operator(&).
To assign the address of an integer variable to the pointer variable ptr use the following code.
int x = 10;
int *ptr;
ptr = &x;
This assigns the address of x to the pointer variable ptr.

27
Q

What is a signed int and an unsigned int?

A

They are used to specify the range of values that a variable can hold. A signed variable can hold both positive and negative values, while an unsigned variable can only hold non-negative values.

28
Q

What is the difference between short vs long?

A

Short and long are used to specify the range of values that a variable can hold. A short variable can hold smaller values than an int variable, while a long variable can hold larger values than an int variable.

29
Q

What are local variables?

A

Local variables are declared within a function or block of code and can only be used by statements that are inside that function or block of code. They are not known to functions outside their own.

30
Q

What are global variables?

A

Global variables are declared outside of any function or block of code and can be used by any function or block of code in the program. They are known to all functions in the program.

31
Q

What is a static variable?

A

A variable that is declared with the static keyword inside a function. They are not allocated on the stack, instead they are allocated in the data segment of the program. They have the property of preserving their value even after they are out of their scope. It preserves it previous value in its previous scope and is not initialized again in the new scope.

32
Q

How do you write a struct in c?

A

In C programming, a structure is a user-defined data type that can be used to group items of possibly different types into a single type 1. To define a structure, the struct keyword is used. The syntax of a structure definition is as follows:
struct structureName {
dataType member1;
dataType member2;

};

33
Q

What is the OS Kernel?

A

The kernel is the central component of an operating system that manages the operations of a computer and its hardware. RESOURCE MANAGEMENT, ABSTRACTION, PROTECTION

34
Q

What is virtual memory?

A

Is a memory management technique that allows a computer to use more memory than it physically has available. It is a way of extending the computers main memory by using disk storage as a temporary storage space.

35
Q

What are strings?

A

A sequence of characters terminated with a null character. Strings are represented as arrays of characters and are null terminated, meaning they end with a special character call the null character indicating the end of string.

36
Q

Whats in a virtual memory segment?

A

TEXT,DATA,BSS,HEAP,STACK

37
Q

What is the function of TEXT?

A

Executable code

38
Q

What is the function of data?

A

Initialized global variables

39
Q

What is the function of BSS?

A

Uninitialized global variables (initialized +0)

40
Q

What is the function of heap?

A

dynamic memory

41
Q

What is the function of the stack?

A

Local variables