Operating system Introduction

Operating system is a bridge between a user and the hardware components of a computer. Elements of operating system are Booting loader program, control program and services program. Booting loader program is used to boot the OS of the system. Control program is used to control I/O operation. Service Program provides different types of services to both the user and the system. Loading of operating system (DOS) files into main memory is called booting up the system. Three essential files are loaded into main memory: IO.SYS, MSDOS.SYS and COMMAND.COM. To boot up the system, firstly IO.SYS and MSDOS.SYS files are loaded into the main memory. The loading of CONFIG.SYS is optional. It is used to configure the computer system. Now, the command interpreter of DOS - COMMAND.COM is loaded into the main memory. At last, AUTOEXEC.BAT file is loaded. Finally, the system’s default drive will be displayed. Basic Input and Output System (BIOS) is a pre-installed software, which is used by the computers to start up. It is a small program that controls various electronic devices attached to the main computer system. It also manages data flow between the computer’s operating system and attached devices such as keyboard, hard disk, printer etc.

To Access the full content, Please Purchase

  • Q1

    Write a program using ‘if-else’ statement to print number having maximum value out of two given values.

    Marks:15
    Answer:

    public class maximumVal

    {

    public static void main( String args [ ])

    {

    int a = 12;

    int b = 10;

    if (a > b)

    {

    System.out.println(" a has maximum value " );

    }

    else

    {

    System.out.println(" b has maximum value " );

    }

    }

    }

    Output:

    View Answer
  • Q2

    Write a program in Java to find the sum of the series.

    S = 1+(1+2)+(1+2+3)+……………10 terms. [15]

    Illustrate the working of ‘break’ statement.

    Marks:15
    Answer:

    class series

    {

    Public static void main(String args[ ])

    {

    int S=0;

    for (int c=1;c < =10;c++)

    {for (int d=1;d < =c;d++)

    {

    S=S+d;

    }

    }

    System.out.println("Sum of Series 1+(1+2)+(1+2+3)+ --------+(1+2+3--------+10) is :" +S);

    }

    }

    b) Consider a situation where you are looping from 1 to 5 and you want to find the sum of numbers 1, 4 and 5, except 2 and 3. So, when you reach 2 and 3, you will have to skip the loop. Here, we use the ‘break’ statement.

    sum=0;
    for(i=1;i

    View Answer
  • Q3

    a. Classify access specifiers with their access. [2]

    b. How class variables are made? Explain with example. [2]
    c. What are constants? [2]

    d. What are non-primitive data types? [2]

    e. What is the alternative of if…else statement? [2]

    g. Differentiate between pure and impure expressions. [2]

    h. Explain default constructor and parameterised constructor. [2]

    i. Differentiate between while loop and do-while loop. [2]

    j. State the value of n and ch when [2]
    char c=’A’;

    int n=c+1;

    char ch=(char)n;

    What are the different types of tokens? [2]

    Marks:20
    Answer:

    (a) Java provides four access specifiers:

    Access Specifiers

    Same Class

    Same Package

    Subclass

    Other packages

    public

    Y

    Y

    Y

    Y

    protected

    Y

    Y

    Y

    N

    no access modifier(default)

    Y

    Y

    N

    N

    private

    Y

    N

    N

    N

    (b) Class variables are made by declaring variable with ‘static’ keyword.

    Example:

    class xyz

    {

    int a; // instance variable

    static int b; // class variable

    }

    (c) A constant is a variable that does not change its value during the execution of a program. Example: char ch =‘s’, here the value of ch will remain the same in the program. The different types of constants used in Java program are: integer, real, character and string constant.

    (d) Non Primitive Data Types are directly or indirectly dependent on primitive data types. They are also known as derived data types like arrays, structure etc.

    (e) The conditional operator (? :) can be used as an alternative to if-else statement. Compared to if-else sequence, conditional operator (? :) offers more concise, clean and compact code.

    (f) A pure expression is one in which all the elements are of same data type whereas an impure expression contains elements of different types,

    (g) A constructor which initializes instant variable of an object with definite values readily defined is known as default.

    A parameterized constructor is a member function with same name as the class name which is used to initialize the parametric values at the time of its creation.

    While loop

    Do-while loop

    The while loop will not execute at all if the condition is not satisfied.

    The do….while loop will continue at least once even if the condition is not satisfied.

    while loop checks the condition first and then execution begins.

    The do….while loop checks the condition after executing the loop once.

    It is an entry controlled loop.

    It is an exit controlled loop.

    i. The value of:
    n=66
    ch=B

    (j) Different types of tokens available in java are: Literals, Operators, Identifiers, Punctuators, Separators and Assignment.

    View Answer
  • Q4

    (a) Explain specifiers or access or visibility rules. [2]
    (b)
    Differentiate Shift Left and Shift Right operations. [2]
    (c)
    What are the values of x and y when the following statements are executed? [2]
    int a=52, b=38;

    boolean x=(a > b)? a:b;

    int y=(a < b)?a:b;
    (d) Which operators are used to show relationship among the operators? [2]

    (e) Mention any two Object Oriented Programming principles? [2]

    Marks:10
    Answer:

    (a) Access or visibility rules determine whether a method or a data variable can be accessed by another method in another class or subclass.

    (b) The Shift Left ( > ) shifts the bit pattern of the operand towards right by defining number of bits.

    (c) The statement given below is wrong:

    boolean x=(a >b)?a:b;

    Should be:

    boolean x=(a >b)?true : false; then,

    x=true

    y=38

    (d) Relational operators are operators used to show the relationship among the operands. Relational operators compare the values of the variables and result in ‘True’ or ‘False’ (i.e., 0 or 1). The different types of relational operators are:

    Symbol

    Meaning

    <

    Less than

    >

    Greater than

    =

    Greater than or equal to

    ==

    Equal to

    !=

    Not equal to

    (e) The two principles of Object Oriented Programming are:

    (1) Encapsulation: It is a system of wrapping data and functions of a class as a unit.

    (2) Data Abstraction: It is an act of representing essential features of a class without knowing its background details.

    View Answer
  • Q5

    (a) Why is a class called an object factory? [2]
    (b) What do you mean by ‘reusability’ feature? [2]
    (c) Explain Encapsulation. [2]
    (d) Write a Java statement to create an object iphone of class mobiles. [2]
    (e) What does Polymorphism mean? [2]

    Marks:10
    Answer:

    (a) Class is used to produce or create various objects containing common attributes and behavior. Hence class is called an object factory.
    (b) When a class inherits features from another class then it may happen that some of the components used in the base class are applied to base class for some operations. This feature is said to be the reusability feature which can be implemented through inheritance.
    (c) The wrapping of data and function of a class so that they can be applied as a unit is termed as Encapsulation.
    (d) Java statement to create an object iphone of class mobiles: mobiles iphone=new mobiles();
    (e) Poly means Many and Morphos means Shapes or the forms. Polymorphism is the ability for a message or data to be processed in more than one form.

    View Answer