Week 1 Flashcards

(81 cards)

1
Q

For a file containing source code in the C language it’s name ends how?

A

test.c

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

What does return 1; mean?

A

There was some problem with the execution of the function.

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

An instruction list (IL) is a…

A

…complete set of well-known commands.

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

Which words cannot be used to name variables?

A

Reserved keywords, unless their case is changed (int - no, Int - yes).

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

The binary system is the system computers use to …

A

… store numbers.

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

What types of numbers do modern computers handle?

A
  • integers

- floating-point numbers (or floats) that can be fractional

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

What is the best book about C programming ever written?

A

“The C Programming Language” by Dennis Ritchie and Brian Kernighan, also called “Kernighan-Ritchie”

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

What is the algorithm for a simple program which is only to display a certain text on the screen?

A

1) start
2) write text
3) stop

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

What rules exist with regards to the name of variables?

A
  • only upper-case or lower-case Latin letters, digits and the character _ (underscore) are allowed
  • variable name must begin with a letter
  • the underline character is a letter
  • upper- and lower-case letters are treated as different (Alice is not ALICE)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the new value if the variable Result?

Result = 100 + 200

A

300

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

What does int main(void) mean?

A
  • result of function: an integer value
  • name of function: main
  • parameters: no parameters required
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The characteristic of a number which determines its kind, range and application is called a …

A

…type.

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

What does a compiler do with statements in quotes?

A

They are considered string and ignored. They only look like part of the source code.

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

Each instruction in C must end with a…

A

…semicolon.

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

Is ‘_Exchange’ a valid variable name?

A

yes

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

The changes the preprocessor introduces are controlled entirely by its …

A

directives.

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

What does the include preprocessor directive do?

A

It replaces the directive with the content of the file whose name is listed in the directive.

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

How do compilers treat nested comments?

/* int k; /* int m; */ int z; */

A

Either they ignore the whole comment in it’s entirety or they treat part of it as variable and the rest will be invalid. Beware!

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

A computer only responds to a predetermined…

A

…set of commands.

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

What is the interior of a function called?

A

body

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

Computer programming is the act of…

A

…composing selected commands (instructions) in the proper order so that a desired effect is produced.

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

What does a compiler do if the source code is split over several files?

A

There are 2 phases - a compilation and a linking phase. It translates the source files into machine language and a linker then links these files into a single executable file.

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

Programs written in high-level languages can be translated into any number of different machine languages and run on different computers. What is this feature called?

A

portability

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

A program we write will not run or produce acceptable results unless it is correct in these 3 ways…

A

…lexically, syntactically and semantically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How can the computer understand high-level programming languages?
They need to be translated by a translator.
26
native language
- accompanies us throughout life | - learned almost unconsciously at the very beginning of our programming career
27
What does every variable have?
- name - type - value
28
How is a comment denoted in C code?
/* blah blah blah */
29
What does x = x + 1 mean?
Take the current value of the variable x, add 1 to it and store the result in the variable x. OR The value of x is incremented by 1. (This does NOT mean x equals x + 1!)
30
The boundary between integers and floats is very ... Both of these kinds of numbers significantly differ in how they are ... in a computer’s memory and in the range of ...
strict, stored, acceptable values
31
What is the most common use of “C”?
- it is the general-purpose programming language, suitable for any project - best used for coding drivers, embedded applications or operating systems - can also be used for building complex utilities
32
An IL is commonly known as what?
Machine language.
33
What kind of files usually end on a .h?
header files
34
How is the function body denoted?
with { }
35
Does the preprocessor modify the content of the source file?
No. Alterations are made on a volatile copy of the program, which disappears after compilation.
36
natural languages
- languages we use to communicate with each other | - have evolved almost independently, naturally
37
With what set of information does every function in C begin?
- What is the result if the function? - What is the name of the function? - How many parameters does the function have and what are their names?
38
What is the type of a variable?
~ an attribute that uniquely defines which values can be stored inside the variable (e.g. integers (int))
39
The program written in accordance with the rules of a given programming language is called the ... or simply ...
source code, source
40
If you want quick answers regarding C coding where can you get them?
online, the report "ISO/IEC 9899: TC3" by the ISO standardization committee
41
A function is a ... block and is similar to a ... ..., where you insert something and get something different out of it.
building, black box
42
What is a prototype?
~ a set of information (result + name + parameters) - it’s like a label affixed to a function, announcing how you can use that function in your program - says nothing about what the function is intended for
43
The standard of the “C” language assumes that, among the many different blocks which may be put into a program, one specific block must always be present, otherwise the program won't be correct. What is it called?
the function main
44
What is 'puts' an abbreviation for?
PUT String
45
The file which contains the source is called the ...
... source file.
46
The name of an executable file depends on...
...the compiler you use and the operating system you are working with.
47
Create a function by the name of lazy with no result and no parameters and which doesn't do anything.
void lazy(void) {}
48
What is reqired to overcome the practical problems of machine language?
a bridge between natural (human) and machine (computer) language
49
Developers often place a note at the beginning of the source informing us of when they wrote the program and who amended it and why. Give an example.
/************************ Count misses version 2.1 Author: Jane Doe, 2017 Email: jane_doe@dart.org Changes: 02/05/2017: Jon Snow: define misses more accurately ************************/
50
What is the bridge between machine and natural language?
~ an intermediate common language for computers and humans to work together, called high-level programming language
51
Results of calculations are stored as what?
variables
52
Write the code for a program that is to display "Hello World!" on the screen.
#include int main(void) { puts("Hello World!"); return 0; }
53
The name of an invoked function must always be followed by ...
... parentheses.
54
A block inside of a function's body is a ...
...function invocation.
55
What name does an executable file on the Unix/Linux system usually have?
a.out
56
What is '=' in C?
the assignment operator
57
syntax
~ rules of a programming language that determine the appropriate way of collating the symbols
58
What is the preprocessor?
It is a separate part of the compiler that pre-reads the text of the program and makes modifications to it. That happens before the compilation.
59
A remark inserted into a program which is omitted at the time of compiling is called a ...
... comment.
60
programming language
- defined by a set of rigid rules, much more inflexible than any natural language - rules determine which symbols can be used (lexicon) - rules determine appropriate collation of symbols (syntax) - rules determine the meaning of every statement (semantics)
61
What name does an executable file on the MS Windows system usually have?
.exe
62
What does the stdio.h file contain?
It contains a collection of preliminary information about ready-made blocks which can be used by a program to, e.g. write text on the screen.
63
lexicon
~ rules of a programming language that determine which symbols (letters, digits, punctuation marks, etc.) can be used
64
What does 'Counter = 1;' mean?
- assign 1 to Counter OR - Counter becomes 1 OR - assign a value of 1 to a variable called Counter
65
Is 'LittleRedRidingHoodWentIntoTheForestOnHerOwn' a valid variable name?
Yes, but some compilers might restrict the possible length of a string.
66
Each comment is lexically equivalent to what?
one space
67
What are the steps a compiler takes if you "feed" it source code written in a high-level language?
1) reads the code 2) performs some complex analysis to determine if the programmer made an error (cannot detect all errors) 3) in the case of an error the compiler will display it 4) if there is no error, it will produce an executable file in machine language
68
What does return 0; do?
It causes the end of the function execution. '0' is the result of the main function and indicates there was no problem with the execution.
69
Things that are put into the function (box) are called function ... (or function ...). Things that are taken out of the function (box) are called ...
arguments, parameters, results
70
Why don't we directly code in machine language?
1) requires an exhaustive knowledge of a computer's hardware design and it's internal structure; any changes to either hardware or IL make programmers knowledge unusable 2) very hard for humans to understand, costly and cumbersome
71
What does the hash tag at the beginning of the first line of a program mean?
It means the content of the line is a preprocessor directive.
72
semantics
~ rules of a programming language that determine what the meaning of every statement expressed in the given language is
73
Variables come into existence as the result of a ...
... declaration.
74
How does the C language recognise integers?
As a string of digits without any characters other than digits.
75
How did the C language come into existence?
It was invented by Dennis Ritchie while he was working at Bell Laboratories in the early 70s. It's said to be the by-product of the invention of the 1st version of the Unix operating system.
76
What is declared by the following fragment of a program? int variable1, account_balance, invoices;
It declares 3 variables of type int named variable1, account_balance and invoices.
77
What is an algorithm?
~ a structured and formal description of each step of the program
78
What does the block puts() do?
It writes text on a screen.
79
What is machine language?
~ an instruction list - simplest and most primary language to give commands to a computer - the computer's mother tongue
80
The process of translating from a high-level language to machine language is called ... and is done by a specialised computer program called a ...
compilation, compiler
81
Is '10,345,123' a valid variable name?
no