Compsci 110 Flashcards
Explain Lexical Analysis
- Breaks code into tokens: numbers, variables, names, strings, delimiters etc.
- Tokens are classified by type into classes and comments are removed
- Production of non-terminals can be described by BNF grammar, but in lexing we use it to form tokens without syntactical meaning e.g. , ,
What is a challenge faced by a parser during parsing? And how can this be solved?
A challenge is choosing which grammar rules to apply, which one to use first, and which set of leaves to apply them to. This can be solved by backing up the point where the last choice was made and trying a different choice instead.
What is recursion?
A non-terminal on the left reappears in the definition part on the right
::= blah|blah
What elements would you find in a semantic record?
- Data type of the of the non-terminal and the name of the variable
- Data type of the non-terminal symbol the record relates to
What is the role of code optimisation during the compilation process?
Tries to turn code into code that will run faster and removes unnecessary instructions at machine level
What does ‘rwx’ command mean?
Read, write, execute
What is a ‘chmod’ command?
Changes the access permission of files and folders.
The first number sets permission for the user, the second number sets permission for the group and the third number sets permission for everybody else
What does ‘chmod 777’ do?
Gives everyone full access to the file
What does ‘chmod 770’ do?
The user and group members only have full access to the file
What does ‘chmod 755’ do?
The user has full access, group members and everybody else can read and execute the file, no modifications
What is a deadlock?
When two threads needs two different resources and each of them has the lock of the resource that the other need, it is a deadlock
What are the features of multi-programmed operating system?
- Each process needs its own memory space which need to be separate to avoid programs writing into the memory space of another
- Manages program access to external devices and resources e.g. keyboard, mouse, files, networks and printers
What are the features of multi-user operating system?
- A superuser(root) account for administration
- User authentication
What is cloud storage?
In a cloud system, many network drives are connected transparently across many physical locations world-wide, and a user’s data may exist in more than one location, getting synchronized to other locations if it changes in one.
What are potential problems of cloud storage?
- Legitimate access to cloud data by law enforcement
- Privacy of data stored under different legislation