Posts

Creating Games in Python

Image
Installing Pygame Zero This module is meant for beginner game programmers. It is the simpler version of the pygame module. pip install pygame pip install pgzero Simple Test def draw():     screen.draw.text('Hello', topleft = (10, 10)) pgzrun hello.py Shooting Game Create a folder named "shooting game". Under this folder, create a Python file named "shoot.py". Also create a folder named "images" to store the images. Download the apple image and keep it in the "images" folder. from random import randint #Create a new actor called apple #Actors are like Sprites in Scratch apple = Actor('apple') score = 0 def draw():     screen.clear()     apple.draw() #Placing an apple at a specific position def place_apple():     apple.x = randint(10, 500)     apple.y = randint(10, 400) #Dealing with clicks def on_mouse_down(pos):     if apple.collidepoint(pos):         global score         score += 1 ...

Pure & Impure Methods in Java

In Java, methods can be classified as pure methods and impure methods based on whether they change data outside the method or produce side effects. Pure Methods A pure method d oes not modify any object or variable outside the method. It gives the same output for the same input every time. It has no side effects (such as printing, changing variables, writing files, etc.). Example class Demo{     int square ( int n ){         return n * n ;     }     public static void main ( String args []){         Demo obj = new Demo ();         int result = obj . square ( 5 );         System . out . println ( "Square = " + result );     } } The above method is pure because it only calculates and returns a value. It does not change any external variable or object. Impure Methods An impure method changes object data or ex...

Class 6 Computer System SVTS

 The two categories of components that make up a computer are hardware and software . Hardware refers to the physical parts of a computer system that we can touch and feel. Software guides the working of the hardware components. A computer is a programmable electronic device that works according to the given instructions. The input devices are used to give instructions to the computer. The processing is done by the CPU . The results are displayed on the output devices. A computer runs on electricity and understands only two states: ON or OFF . ON is represented by 1 and OFF is represented by 0 . A computer only understands the language of zeros and ones. This language is called the binary language or machine language. An input device converts instructions into binary so that the computer can understand. An output device converts binary data in a form that we can understand. A scanner converts printed documents into electronic formats. A scanning device called OMR is ...

Hotel Customer Inheritance | ISC Computer Science 2026 Theory

A superclass Hotel has been defined to store the details of a hotel. Define a subclass Customer to calculate the total bill for a customer as per the following criteria: Room type          Additional Amount Executive            10% of room rent Suite                      20% of room rent The details of the members of both the classes are given below: Class name : Hotel Data members/instance variables : hname: to store hotel name roomrent: to store the rent per day Methods/Member functions : Hotel(...): parameterized constructor to assign values to its data members void show(): to display hotel details Class name : Customer Data members/instance variables : cname: to store customer name days: to store the number of days of stay type: to store the room type surcharge: to store the additional amount amt: to store the total amount Methods/Member functions : Customer(...): par...

ICSE Computer Applications 2026

Image
  SECTION A (40 Marks) (Attempt all questions from this section) Question 1 Choose the correct answers to the questions from the given options. (Do not copy the questions, write only the correct answers) (i) The full form of JVM is: (a) Java Visible Machine (b) Java Virtual Mode (c) Java Virtual Machine (d) Java Visible Mode (ii) Which of the following occupies 2 bytes of storage? (a) 25 (b) AM (c) 35.2 (d) \\ (iii) In a statement c = c + (x * d + e); which variable is an accumulator? (a) d (b) c (c) e (d) x (iv) Which of the following is not an access specifier? (a) private (b) protected (c) package (d) public (v) What is the output of the statement Math.pow(36, 6 / 5) ? (a) 36.0 (b) 1.0 (c) 73.71 (d) 6.0 (vi) Read the if program segment given below: if(a > b)     z = 25; else     z = 35; Which one of the following is the correct conversion of the if program segment to ternary? (a) z = a > b? 35 : 25; (b) z = a > b? 25 : 35; (c) z = a > b: 35 ? 25;...

Browser Stack Program | ISC Computer Science 2026 Theory

In any internet browser, a user can visit new webpages and go back to previously visited webpages. Each new webpage URL is stored in browser's memory such that when the user clicks 'Back' button, the previous webpage gets displayed. The details of the members of the class are given below: Class name : Browser Data members/instance variables : pages[]: an array to hold the URL's of visited webpages max: to store the maximum capacity of the array top: to point to the index of the last visited webpages Methods/Member functions : Browser(int cap): constructor to assign max = cap and top = -1 void visit(String url): to add URL of a new webpage if possible, else display the message "Browser history full" String back(): to remove and return the last visited webpage URL, if present, else to return the message "No previous browser history" (i) Specify the class Browser giving details of the functions void visit(String) and String back(). Assume that the other...

Pendulum String Program | ISC Computer Science 2026 Theory

Design a class PendulumS to perform an operation on a word containing alphabets in uppercase only. Rearrange the word by putting the lowest ASCII value character at the centre and the second lowest ASCII value character to its right and the third to its left and so on. Example 1 : INPUT: COMPUTER OUTPUT: TPMCEORU Example 2 : INPUT: SCIENCE OUTPUT: SIECCEN The details of the members of the class are given below: Class name : PendulumS Data members/instance variables : wrd: to store the original word newwrd: to store the rearranged word Methods/Member functions : PendulumS(String k): parameterised constructor to initialise wrd = k and newwrd = "" int minCharIndex(String str): to find the index of the minimum ASCII value character in str and return it void arrange(): to rearrange the characters of wrd as per the given instructions and store it in newwrd by invoking minCharIndex() void display(): to display the original word and the rearranged word Specify the c...