Sample Computer Question Paper for Class 8

1. Answer the following:

a) What computer languages are used to develop apps for iOS?
C and Objective C.
b) Which two components bound a 2-D chart? Name them.
x-axis and y-axis.
c) How apps work? What protocol is followed by a client to communicate?
Apps work on client-server model. The mobile is the client that requests for services, whereas the server is a remote computer that sends the data to the client. They use HTTP protocol to communicate.
d) If int x = 2 and double y = 7.0, evaluate x *= x++ / y + –y;
x = x * (x++ / y + –y)
= 2 * (2 / 7.0 + 6.0)
= 2 * (0.285 + 6.0)
= 2 * 6.285
= 12.57
e) What is the importance of stock chart?
It helps the investors, stock companies and traders to analyze the fluctuation in stock prices.

Give the full form of the following:

i. VOIP: Voice Over Internet Protocol
ii. GPS: Global Positioning System

Fill in the blanks:

i. The values for the formal parameters are termed as arguments.
ii. Web apps are not installed locally.
iii. In MS Excel, Major Gridlines are gridlines at large intervals.
iv. Web App is a type of app that does not appear on the device as an app icon.

Java Programs:

4. A library charges fine for the books returned late. Following are the fines:
First 5 days: Rs. 4.00 per day
6 to 10 days: Rs. 6.00 per day
Above 10 days: Rs. 8.00 per day.
Design a class Library to calculate the fine assuming that a book is returned N days late.

import java.io.*;
class Library{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.print("Number of days late: ");
        int n = Integer.parseInt(br.readLine());
        double fine = 0.0;
        if(n <= 5) fine = n * 4.0; else if(n > 5 && n <= 10)
            fine = (n - 5) * 6.0 + 5 * 4.0;
        else
            fine = (n - 10) * 8.0 + 5 * 6.0 + 5 * 4.0;
        System.out.println("Total Fine: Rs. " + fine);
    }
}

5. Write a program in Java to accept the values for u and s. Assign -5 to a. If either of the inputs is even, display the value of v as an integer, if v = √(u2 + 2as).

import java.io.*;
class Solve{
    public static void main(String args[])throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int a = -5;
        System.out.print("u = ");
        int u = Integer.parseInt(br.readLine());
        System.out.print("s = ");
        int s = Integer.parseInt(br.readLine());
        if(u % 2 == 0 || s % 2 == 0 || a %2 == 0){
            int v = (int)Math.sqrt(u * u + 2 * a * s);
            System.out.println("v = " + v);
        }
    }
}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.