CSE 2421 Midterm 1 Exam Questions With Complete
Answers 100% Pass
UNIX - ANSWER -Proprietary
-AT&T, Bell Labs
-Bourne Shell
-Solaris, macOS, HP-UX
-Not portable
Linux - ANSWER -Open source
-Linus Torvald
-BASH(Bourne Again Shell)
-Debian, Ubuntu, Fedora, Android
-Portable
What made UNIX different from all other commercially available software systems when it
was initially developed? - ANSWER UNIX was different from other software's at the time
because it only needed one portion of code changed per system called the kernel. Originally,
OSs had to be completely rewritten for every system.
What was the C programming language initially created? - ANSWER C was originally
developed to help create the UNIX OS and its utilities
,How is white space (tabs/newlines/returns, spaces, etc.) handled within a C program file? -
ANSWER White spaces are generally ignored by the C compiler. I believe this is a good thing
because all white space adds is readability for humans
What does the command cd cse2421 do? - ANSWER Changes the current working directory to
cse2421
What does the command cd ~ do? - ANSWER Changes the current working directory to your
home-directory
What does the command wc lab1.c do? - ANSWER Counts number of lines/words/characters
in a file
What does the man command allow you to do? - ANSWER Reads the online manual for the
current version of a command
What does the command mv file1 file2 do? - ANSWER Changes the name of file1 to file2
What is the format for the mv command? - ANSWER mv [options] source destination
What does an asterisk(*) specify in a file name? - ANSWER The asterisk specifies all files
,Can the second parameter of a mv command legally be a directory name? - ANSWER Yes
If you put an & character at the end of your command, what happens? - ANSWER Linux opens
a new command window and launches the command in that window
Why aren't open source systems always free? - ANSWER Corporate support versions and
specially modified versions cost a premium
Free as in freedom, not free
Differences between C and Java - ANSWER -C does not support the notion of classes or
objects, in an object-orientated sense
-C does not support encapsulation as all memory is modifiable/executable
-does not support inheritance
-procedure-orientated, not object-orientated
-compiled, not interpreted like java
-C has functions, java has methods
-C is not portable(platform dependent), where java is portable
-developed in early 70s vs 1995 for java
Compile time errors (static errors) - ANSWER Errors found during compilation
e.g. syntax errors
, Run time errors (dynamic errors) - ANSWER Errors found while running the program
e.g. logical or semantic errors
Four categories of statements - ANSWER 1. Declarations
2. Data movement
3. Arithmetic/Logical operations
4. Control flow
Preprocessor directive - ANSWER a C program line beginning with # that provides an
instruction to the preprocessor
#define - ANSWER a directive that defines a macro
#ifdef, #ifndef - ANSWER Specialized forms that test whether a name is defined
#endif - ANSWER Preprocessor directive that ends an #ifdef or #ifndef region
#include - ANSWER replaces the directive with the content of the file whose name is listed in
the directive (generally a list of functions prototypes and macros)
4 programs in order that combine to create the gcc command - ANSWER 1. Preprocessor
Answers 100% Pass
UNIX - ANSWER -Proprietary
-AT&T, Bell Labs
-Bourne Shell
-Solaris, macOS, HP-UX
-Not portable
Linux - ANSWER -Open source
-Linus Torvald
-BASH(Bourne Again Shell)
-Debian, Ubuntu, Fedora, Android
-Portable
What made UNIX different from all other commercially available software systems when it
was initially developed? - ANSWER UNIX was different from other software's at the time
because it only needed one portion of code changed per system called the kernel. Originally,
OSs had to be completely rewritten for every system.
What was the C programming language initially created? - ANSWER C was originally
developed to help create the UNIX OS and its utilities
,How is white space (tabs/newlines/returns, spaces, etc.) handled within a C program file? -
ANSWER White spaces are generally ignored by the C compiler. I believe this is a good thing
because all white space adds is readability for humans
What does the command cd cse2421 do? - ANSWER Changes the current working directory to
cse2421
What does the command cd ~ do? - ANSWER Changes the current working directory to your
home-directory
What does the command wc lab1.c do? - ANSWER Counts number of lines/words/characters
in a file
What does the man command allow you to do? - ANSWER Reads the online manual for the
current version of a command
What does the command mv file1 file2 do? - ANSWER Changes the name of file1 to file2
What is the format for the mv command? - ANSWER mv [options] source destination
What does an asterisk(*) specify in a file name? - ANSWER The asterisk specifies all files
,Can the second parameter of a mv command legally be a directory name? - ANSWER Yes
If you put an & character at the end of your command, what happens? - ANSWER Linux opens
a new command window and launches the command in that window
Why aren't open source systems always free? - ANSWER Corporate support versions and
specially modified versions cost a premium
Free as in freedom, not free
Differences between C and Java - ANSWER -C does not support the notion of classes or
objects, in an object-orientated sense
-C does not support encapsulation as all memory is modifiable/executable
-does not support inheritance
-procedure-orientated, not object-orientated
-compiled, not interpreted like java
-C has functions, java has methods
-C is not portable(platform dependent), where java is portable
-developed in early 70s vs 1995 for java
Compile time errors (static errors) - ANSWER Errors found during compilation
e.g. syntax errors
, Run time errors (dynamic errors) - ANSWER Errors found while running the program
e.g. logical or semantic errors
Four categories of statements - ANSWER 1. Declarations
2. Data movement
3. Arithmetic/Logical operations
4. Control flow
Preprocessor directive - ANSWER a C program line beginning with # that provides an
instruction to the preprocessor
#define - ANSWER a directive that defines a macro
#ifdef, #ifndef - ANSWER Specialized forms that test whether a name is defined
#endif - ANSWER Preprocessor directive that ends an #ifdef or #ifndef region
#include - ANSWER replaces the directive with the content of the file whose name is listed in
the directive (generally a list of functions prototypes and macros)
4 programs in order that combine to create the gcc command - ANSWER 1. Preprocessor