COM 212INTRODUCTION TO SYSTEM PROGRAMMING                           19/130936
ND II STREAM A
QUESTIONS
Q1) Using a Flowchart show a program that can be use to take for the
shortest guy in ND2.
Q2) Write an Algorithm to find the tallest in Computer Science ND2.
Q3) Tokens are use for what in C language, Give an example.
Q4) Write a program in C language using String Constant.
Q5) In a Tabular form, Show the difference between the following Primary
and Secondary storage.
Q6) In a Tabular form, Show the difference between,
 i.    Cache and primary memory.
 ii.   Optical and Secondary memory.
Q7) Explain the difference between Symbolic and Assembly language.
Q8) Explain with Diagram Compilation Model.
Q9) In assembly language write a program to add (2+3+4+5)-(5+6+7+8)
Q10) List and explain 5 special symbols in C program with examples
                                                                                1
     COM 212INTRODUCTION TO SYSTEM PROGRAMMING                                          19/130936
                                                                                   ND II STREAM A
     Q1) USING A FLOWCHART SHOW A PROGRAM THAT CAN BE USE
     TO TAKE FOR THE SHORTEST GUY IN NDII
                                             Start
                                 declare a, b,c as shortest in
                                 Nd2.
                                          read a b,c
                                            If a < b
                             NO                                  YES
                NO
                      If b < c             YES         NO              If a < c   YES
c is shortest                             b is shortest                           a is shortest
                                               Stop
                                                                                                    2
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                         19/130936
                                                             ND II STREAM A
Q2) WRITE AN ALGORITHM TO FIND THE TALLEST IN COMPUTER
SCIENCE NDII
STEP1: START
STEP2: declare a, b, c as tallest in NDII.
STEP3: read a, b, c from the user.
STEP4: if (a > b and a > c ) Then
STEP5: Print “ a is tallest “
STEP6: Elseif(b>a) Then
STEP7: Print “ b is a tallest “
STEP8: Else
STEP9:Print “c is a tallest “
STEP10: End if
STEP11: STOP
Q3) TOKENS ARE USE FOR WHAT IN C LANGUAGE, GIVE AN
EXAMPLE.
Tokens are the smallest element of a program, which are meaningful to
the compiler. The compiler breaks a program into the smallest units is
called tokens and these tokens proceed to the different stages of
compilation. The following are the type of tokens: Keywords, Identifier,
Constant, Strings, Operators, e.t.c.
                                                                              3
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                               19/130936
                                                                   ND II STREAM A
                      C TOKEN WITH THEIR EXAMPLE
    o   Keywords in C (e.g: int, while),
    o   Identifiers in C (e.g: main, total ),
    o   Strings in C    (eg: “total”, “hello”),
    o   Operators in C (eg: +, /, -, *)
    o   Constant in C (eg: 5, 10)
    o   Special Characters in C (eg: (), {}),
Q4) WRITE A PROGRAM IN C LANGUAGE USING STRING
CONSTANT.
#include<stdio.h>
Int main()
const char ab[]=(“Am by name nabila”);
Printf(“%25s”,ab);
Q5) IN A TABULAR FORM, SHOW THE DIFFERENCE BETWEEN THE
FOLLOWING PRIMARY AND SECONDARY MEMORY.
          DIFFERENCE BETWEEN PRIMARY AND SECONDARY
S/N          PRIMARY MEMORY                       SECOND MEMORY
1       It is also known as Main
                                          It is also known as Permanent and
        Memory and Internal
                                          External Memory.
        Memory.
2       Primary memory is directly        Secondary memory is not directly
                                                                                    4
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                              19/130936
                                                                  ND II STREAM A
      accessible by Processor/CPU.     accessible by the CPU.
3     Limited capacity                 Extensible capacity
4     primary memories are             Secondary memories are optical and
      semiconductor                    magnetic memories
      memoris
5     Primary memory is also           Secondary memory is also known as
      known as Main Memory or          External memory or Auxiliary
      Internal memory.                 memory.
Q6) IN A TABULAR FORM, SHOW THE DIFFERENCE BETWEEN,
         i. CACHE AND PRIMARY MEMORY.
         ii. OPTICAL AND SECONDARY MEMORY.
DIFFERENCES BETWEEN CACHE MEMORY AND PRIMARY
MEMORY
 S/         CACHE MEMORY                        PRIMARY MEMORY
  N
1     Comparatively closer             Comparatively far
2     Comparatively fast               Comparatively slow
3     Located on the processor         It is a part of the hard drive (secondary
      itself                           storage)
DIFFERENCES BETWEEN OPTICAL MEMORY AND PRIMARY
MEMORY
S/N           OPTICAL MEMORY                      SECONDARY MEMORY
                                                                                   5
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                                19/130936
                                                                    ND II STREAM A
1       Optical memory is temporary           Secondary Memory is permanent
        memory                                memory
2       Optical memory is an electronic       Secondary memory refers to
        storage medium that uses laser        various storage media on which a
        beams to store and retrieve data      computer can store data and
                                              programs.
3       Require additional drivers to         Does not require additional drivers.
        function
Q7) EXPLAIN THE DIFFERENCE BETWEEN SYMBOLIC AND
ASSEMBLY LANGUAGE
Symbolic Language- A symbolic language is a language that uses
characters or symbols to represent concepts, such as mathematical
operation and the entities (or operands) on which these operations are
performed. Some programming languages (suchas Lisp and Mathematical)
make it easy to represent higher-level abstractions as expressions in the
language, enabling  symbolic programming
While
Assembly language- An assembly language is a low level language.
Assembly language use numbers, symbols, and abbreviation instead of 0
and 1s. For example; for addition, subtraction, multiplications, it uses
symbols likes Add, sub and mul e.t.c. It gives instructions to the processors
for different tasks. It is specific for any processor. the assembly language is
close to a machine language but has a simpler language and code.
                                                                                     6
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                              19/130936
                                                                  ND II STREAM A
Q8) EXPLAIN WITH DIAGRAM COMPILATION MODEL.
Compilation Model. - The compilation is a process of converting the
source code into object code. It is done with the help of the compiler. The
compiler checks the source code for the syntactical or structural errors,
and if the source code is error-free, then it generates the object code.
Compilation process converts the source code taken as input into the
object code or machine code. The compilation process can be divided into
four steps, i.e., Pre-processing, Compiling, Assembling, and Linking.
Preprocessor
A preprocessor, generally considered as a part of compiler, is a tool that
produces    input   for   compilers.   It   deals   with   macro-processing,
augmentation, file inclusion, language extension, etc..
                                                                                   7
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                             19/130936
                                                                 ND II STREAM A
Compiler
The code which is expanded by the preprocessor is passed to the
compiler. The compiler converts this code into assembly code. Or we can
say that the C compiler converts the pre-processed code into assembly
code.
Assembler
The assembly code is converted into object code by using an assembler.
The name of the object file generated by the assembler is the same as the
source file. The extension of the object file in DOS is '.obj,' and in UNIX,
the extension is 'o'. If the name of the source file is 'hello.c', then the
name of the object file would be 'hello.obj'.
Linker
Linker is a computer program that links and merges various object files
together in order to make an executable file. All these files might have
been compiled by separate assemblers. The major task of a linker is to
search and locate referenced module/routines in a program and to
determine the memory location where these codes will be loaded, making
the program instruction to have absolute references.
Q9) IN ASSEMBLY LANGUAGE WRITE A PROGRAM TO ADD
(2+3+4+5)-(5+6+7+8)
PUSH 2,I
                                                                                  8
COM 212INTRODUCTION TO SYSTEM PROGRAMMING           19/130936
                                               ND II STREAM A
PUSH 3,J
PUSH 4,K
PUSH 5,L
PUSH H
ADD I,J,K,L
PRINT H
PUSH 5,M
PUSH 6,N
PUSH 7,O
PUSH 8,P
PUSH Q
ADD M,N,O,P
PRINT Q
PUSH H
PUSH Q
PUSH R
SUB Q,F
PRINT R
Q10) LIST AND EXPLAIN 5 SPECIAL SYMBOLS IN C PROGRAM
WITH EXAMPLES
     Parentheses()
                                                                9
COM 212INTRODUCTION TO SYSTEM PROGRAMMING                          19/130936
                                                              ND II STREAM A
     Assignment operator(=)
     Braces{}
     Pre-processor (#)
     Semicolon(;)
    Parentheses()-These special symbols are used for function calls
     and function parameters.
    Assignment operator(=) − It is used for assigning values.
    Braces{} − Opening and closing of curly braces indicates the start
     and end of a block of code which contains more than one executable
     statement.
    Pre-processor (#) − The pre-processor called as a macro
     processor is used by the compiler to transform your program before
     the actual compilation starts. E.g
      #include <stdio.h>
    Semicolon(;) − It is called as a statement terminator that indicates
     the end of one logical entity. That is the reason each individual
     statement must be ended with a semicolon.
                                                                               10