Posts

Showing posts with the label binary search

Binary Search ISC Computer Science 2020 Theory

Design a class BinSearch to search for a particular value in an array. Some of the members of the class are given below: Class name : BinSearch Data members/instance variables : arr[]: to store integer elements n: integer to store the size of the array Member functions/methods : BinSearch(int num): parameterized constructor to initialize n = num void fillArray(): to enter elements in the array void sort(): sorts the array elements in ascending order using any standard sorting technique int binSearch(int l, int u, int v): searches for the value 'v' using binary search and recursive technique and returns its location if found otherwise returns -1. Define the class BinSearch giving details of the constructor, void fillArray(), void sort(), and binSearch(int, int, int). Define the main() function to create an object and call the functions accordingly to enable the task. import java.util.Scanner; class BinSearch{     int arr[];     int n;     public BinSearc...

ICSE Computer Applications 2022 Semester 2 Examination

SEMESTER 2 EXAMINATION COMPUTER APPLICATIONS Maximum Marks: 50 Time Allowed: One and a half hours Answers to this paper must be written on the paper provided separately. You will not be allowed to write during the first 10 minutes. This time is to be spent in reading the question paper. The time given at the head of this paper is the time allowed for writing the answers. Attempt all questions from Section A and any four questions from Section B. The marks intended for questions are given in brackets [ ]. SECTION A (Attempt all questions) Question 1 [10] Choose the correct answers to the questions from the given options. (Do not copy the question. Write the correct answer only) (i) Return data type of isLetter(char) is ________. (a) Boolean (b) boolean (c) bool (d) char (ii) Method that converts a character to uppercase is ________. (a) toUpper() (b) ToUpperCase() (c) toUppercase() (d) toUpperCase(char) (iii) Give the output of the following String methods: "SUCESS".indexOf(...