AKTU 1st Year Sem 2 Solved Paper 2014-15 | COMP. SYSTEM & C PROGRAMMING | Sec A

Paper download link: Paper | Sem 2 | 2014-15

B.Tech.
(SEM-II) THEORY EXAMINATION 2014-15
COMPUTER SYSTEM & PROGRAMMING IN C

Time: 3hrs
Total Marks: 100

Note:-

  • Attempt all questions. Marks are indicated against each question.
  • Assume suitable data wherever necessary.

    1. Attempt any FOUR parts: (5*4 = 20)

    1. Draw the memory hierarchical structure of a computer system. Explain each memory unit in brief.



      This Memory Hierarchy Design is divided into 2 main types:

      1. External Memory or Secondary Memory –
        Comprising of Magnetic Disk, Optical Disk, Magnetic Tape i.e. peripheral storage devices which are accessible by the processor via I/O Module.
      2. Internal Memory or Primary Memory –
        Comprising of Main Memory, Cache Memory & CPU registers. This is directly accessible by the processor.
    2. What is an Operating System? Describe the functionalities of operating system.

      The fundamental goal of a Computer System is to execute user programs and to make tasks easier. Various application programs along with hardware system are used to perform this work. Operating System is a software which manages and control the entire set of resources and effectively utilize every part of a computer.

      The figure shows how OS acts as a medium between hardware unit and application programs.

      Functions of an Operating System

      An operating system has variety of functions to perform. Some of the prominent functions of an operating system can be broadly outlined as:

      • Processor Management: This deals with management of the Central Processing Unit (CPU). The operating system takes care of the allotment of CPU time to different processes. When a process finishes its CPU processing after executing for the allotted time period, this is called scheduling.
      • Device Management:
        The Operating System communicates with hardware and the attached devices and maintains a balance between them and the CPU. This is all the more important because the CPU processing speed is much higher than that
        of I/O devices. In order to optimize the CPU time, the operating system employstwo techniques – Buffering and Spooling.
      • Buffering:
        In this technique, input and output data is temporarily stored in Input Buffer and Output Buffer. Once the signal for input or output is sent to or from the CPU respectively, the operating system through the device controller moves the data from the input device to the input buffer and for the output device to the output buffer. In case of input, if the buffer is full, the operating system sends a signal to the program which processes the data stored in the buffer. When the buffer becomes empty, the program informs the operating system which reloads the buffer and the input operation continues.
      • Spooling (Simultaneous Peripheral Operation on Line):
        This is a device management technique used for processing of different tasks on the same input/output device. When there are various users on a network sharing the same resource then it can be a possibility that more than one user might give it a command at the same point of time. So, the operating system temporarily stores the data of every user on the hard disk of the computer to which the resource is attached. The individual user need not wait for the execution process to be completed. Instead the operating system sends the data from the hard disk to the resource one by one.
        Example: printer
      • Memory management:
        In a computer, both the CPU and the I/O devices interact with the memory. When a program needs to be executed it is loaded onto the main memory till the execution is completed. Thereafter that memory space is freed and is available for other programs. The common memory management techniques used by the operating system are Partitioning and Virtual Memory.
      • Partitioning:
        The total memory is divided into various partitions of same size or different sizes. This helps to accommodate number of programs in the memory. The partition can be fixed i.e. remains same for all the programs in the memory or variable i.e. memory is allocated when a program is loaded on to the memory. The later approach causes less wastage of memory but in due course of time, it may become fragmented.
      • Virtual Memory:
        This is a technique used by the operating systems which allow the user can load the programs which are larger than the main memory of the computer. In this technique the program is executed even if the complete program can not be loaded inside the main memory leading to efficient memory utilization.
      • File Management:
        The operating System manages the files, folders and directory systems on a computer. Any data on a computer is stored in the form of files and the operating system keeps information about all of them using File Allocation Table (FAT). The FAT stores general information about files like filename, type (text or binary), size, starting address and access mode (sequential/indexed sequential/direct/relative). The file manager of the operating system helps to create, edit, copy, allocate memory to the files and also updates the FAT. The operating system also takes care that files are opened with proper access rights to read or edit them.
    3. Describe Compiler, interpreter, assembler? Write the names of compiler that are used in C programming.

      The language processors can be any of the following three types:

      1. Compiler –
        The language processor that reads the complete source program written in high level language as a whole in one go and translates it into an equivalent program in machine language is called as a Compiler.
        Example: C, C++, C#, Java

        In a compiler, the source code is translated to object code successfully if it is free of errors. The compiler specifies the errors at the end of compilation with line numbers when there are any errors in the source code. The errors must be removed before the compiler can successfully recompile the source code again.>

      2. Assembler –
        The Assembler is used to translate the program written in Assembly language into machine code. The source program is a input of assembler that contains assembly language instructions. The output generated by assembler is the object code or machine code understandable by the computer.



      3. Interpreter –
        The translation of single statement of source program into machine code is done by language processor and executes it immediately before moving on to the next line is called an interpreter. If there is an error in the statement, the interpreter terminates its translating process at that statement and displays an error message. The interpreter moves on to the next line for execution only after removal of the error. An Interpreter directly executes instructions written in a programming or scripting language without previously converting them to an object code or machine code.
        Example: Perl, Python and Matlab.

      Name of the Compilers in C language:

      • Microsoft Visual Studio Community
      • Xcode
      • Tiny C Compiler (TCC)
      • Clang
      • GNU C Compiler
    4. What do you mean by Algorithm? Explain the properties of algorithm.

      The word Algorithm means “a process or set of rules to be followed in calculations or other problem-solving operations”. Therefore Algorithm refers to a set of rules/instructions that step-by-step define how a work is to be executed upon inorder to get the expected results.

      Properties of an Algorithm

      • Clear and Unambiguous: Algorithm should be clear and unambiguous. Each of its steps should be clear in all aspects and must lead to only one meaning.
      • Well-Defined Inputs: If an algorithm says to take inputs, it should be well-defined inputs.
      • Well-Defined Outputs: The algorithm must clearly define what output will be yielded and it should be well-defined as well.
      • Finiteness: The algorithm must be finite, i.e. it should not end up in an infinite loops or similar.
      • Feasible: The algorithm must be simple, generic and practical, such that it can be executed upon will the available resources. It must not contain some future technology, or anything.
      • Language Independent: The Algorithm designed must be language-independent, i.e. it must be just plain instructions that can be implemented in any language, and yet the output will be same, as expected.
    5. Differentiate high level and machine level language.

      High level languages are nearly human languages. In other words, these are the languages in which the code are written in a language which are more understood by the human than by the machines.

      Low level languages or Machine Level languages are nearly machine languages. In other words, these are the languages in which the code are written in a language which are more understood by the machines than by the humans.

    6. What is pseudo code? Differentiate between flow chart and algorithm with example.

      Pseudocode: It is one of the methods which can be used to represent an algorithm for a program. It does not have a specific syntax like any of the programming languages and thus cannot be executed on a computer. There are several formats which are used to write pseudo-codes and most of them take down the structures from languages such as C, Lisp, FORTRAN, etc.



    My Personal Notes arrow_drop_up

    Technical Content Engineer at GeeksForGeeks

    If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




    Article Tags :

    Be the First to upvote.


    Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.