Week 1 - Basics Flashcards
Is C imperative or declarative?
Imperative
What is the difference between imperative and declarative programming languages?
Imperative describes computation in terms of statements that change a program state, e.g. C.
Declarative describes computation in terms of what is should accomplish, e.g. SQL.
Is C object-oriented or procedural/functional?
Procedural/functional
Is C compiled or interpreted?
Compiled
C is statically, weakly typed - what does this mean?
Statically typed - types are checked before runtime (must declare variables before you use them).
Weakly typed - supports implicit type conversions.
How do you declare a comment in C?
/* this is a comment */
What does it mean when the main() function returns 0?
Success - everything else normally means failure.
What is the statement #include <stdio.h> called, what part is the header file, and what is it used for?</stdio.h>
A compiler directive - used for including a library (in this case I/O with stdio.h, which is the header file)
What header file is needed for standard I/O (input/output)?
stdio.h
What is the process of turning a .c file into an executable program?
Source (.c or .h) compiles to object (.o or .obj), which is linked to executable (.exe)
What is the standard compile?
gcc -ansi -c myProgram.c -o myProgram.o
(note -ansi not necessarily required)
What is the standard link?
gcc myProgram.o -o myProgram
How can several object files be linked together?
gcc myProgram.o mySubroutines.o -o myProgram
What do make and makefiles do?
Utility for building executables and libraries from source code (compiling). They define how to compile and link files to build an executable. They only regenerate intermediate files when necessary.
What is the header file for using mathematical functions (e.g. sqrt)?
math.h