Skip to main content

Posts

Find the bug in the following code.

This code opens / creates / reads and writes / appends to text files as specified by the user. Assuming that the user has entered numeric, comma-separated data, the GetRange module calculates the range and the range coefficient (lookup Statistics - Measures of Dispersion Std XI). Somewhere in this last bit the program does a few mistakes. Imports System.io Public Class FileOps     Public Response As Integer     Private Sub ReadFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReadFile.Click         MyFileData.Clear()         If CreateFile() > -1 Then MyFileData.Text = File.ReadAllText(MyFilePath.Text)     End Sub     Private Sub SaveToFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SaveToFile.Click         If CreateFile() = -1 Then Exit Sub         If File.ReadAllText(MyFilePath.Text).Length >= 0 Then             Response = MsgBox("The file contains something already. Do you want to overwrite? (Clicking on 'No' wil

Branching & Simple Looping assignment for VB.Net

Std XI Sc. students, Write programs using IF ... THEN ... ELSE and GOTO only (i.e. without SELECT CASE or FOR...NEXT) Prof. Anand is a greaaaat mathematician who is always in search for a particular kind of numbers. So he asks random people on the street to give a number and if they give one which does not satisfy the rules below, he chews their head off (NOT LITERALLY, but by giving a LOOOONG derivation as to how they are wrong). Now the professor has asked you to write a program for him, to save his time. (which he can use more productively to chew people's heads off) His rules are as follows: The number should be odd The number should be divisible by 7 The number should be at least 3 digits long   The servo controller program (one that controls the movement) for the GMRT telescopes has the logic given below. Write a code which will take the required inputs, take the required decision and message the decided action. Take the coordinates - Altitude and Azimuth - from the user, in

Learning Programming-Speak

Hello There Std XI (2011-12)! Here's your first assignment. You dont need VB to do it. Write the computer equivalent of the expressions shown in the picture. Is there an error in the following statement, if so, spot and rectify. -  A High Level Language is translated because it is complicated Are the following statements true or false? Explain Why. "2.7182818" is a double precision data. Is the following statement true or false? Explain Why. - A programming language translator has to be customized for the operating system Why do you need an ASCII code in computers? Why can we not define all numbers as double precision numbers? i.e. why have different numeric data types

XI IT Programming Tasks

Hello again! Its time to get the hang of writing meaningful programs. Try the following: Simple Calculator: Write a program in VB to mimick a simple business calculator, which has buttons for basic mathematical tasks (+, -, *, / and Square-root) and a text box to allow the user to input the numbers which need to be operated upon and the result thereof. A Basic Paint Tool: Write a program which allows the user to do the basic paint & draw operations on the form. (Each operation will be run/selected by clicking on the corresponding button) Choose radius using a scrollbar and hence draw a circle (using Circle command) at the point where user clicks the mouse Draw a square of fixed size (using Line command) from the point where the user clicks the mouse Draw an arbitrary shape using the mouse as a pen. A crypting engine: Write a program which takes an input text from the user and then encodes it in the following way (Caeser code): A-01, B-02, C-03, D-04 ... Z-26; so ABHINAV will loo

XI IT Assignments - Controls: Events & Properties

Hello Programmers, Run through this tutorial cum assignment to get a hang of various controls, their properties and the most used events associated with these controls. Try the following and send me the answers or the codes (zip all files - frm & vbp - and send) on the mail id: events@abhinav.ac.in Form This is the most basic control. You have already seen some events on this object. What is the sequence in which the events Activate, Load & Open occur? To find out, write a simple code for each of these events to display a msgbox saying that the event has occured. Now run the program. One by one the messages will popup showing you what happens and in which order. What does the KeyPress event do? To find out trap this event, i.e. write a small code at this event, say like - MsgBox "Hello". Now run the program and try pressing a key ... What do the MouseUp and MouseDown events do? Trap these events like described above and find out the difference between the two state

Online lecture assignments for XI Sc

Hello Programmers, To use this medium effectively, refresh this page every 10 min or so for as long as the lecture is in session, since I will update this post time and again. You can also try coming in on NetMeeting (if that works) by reading the instructions on our web . Here you go: Given three numbers a, b & c you can find out which is the largest of them by comparing each number with the others in turn. Can you do this in a program? The logic goes like this: 1. Take a, b, c from the user 2. Is a > b and c ... then a is largest 3. Is b > a and c ... then b is largest 4. If none of the above, then c is largest Now what will you do if you need to find the largest among say a 100 numbers??? Can the same logic work? Using arrays makes life better while computing large data. So try this logic Take the numbers as inputs into an array having an appropriate size, say 'n' define an arbitrary high value - max - maybe 0 Run loop from 0 to n In each iteration, check if the i

Assignments for XI Sc - IT

1. Simple Controls A. Write a program to take the price of raw materials A & B from the user and hence compute the cost price. Show the same to the user in a box and then calculate the selling price with 20% profit added to the cost price. Show the same in a separate box. Use four text boxes and name them properly B. Now add a button to the earlier program so that you can run the calculations when the button is clicked and not at Form_Load or Form_Click. If you dont know about buttons ... look below C. Now add a check box (called AddProfit) to the earlier code / form. Hence change your code so that, it will add the profit to the cost price, only it the AddProfit box is checked (i.e. there is a tick mark in it) else, it should simply show the cost price as selling price About Buttons: Use the toolbox you see on the left, OR open the same from the spanner & hammer icon on the top. Click on the plain rectangle below the "A" icon and to its right. Then drag and drop on

Trapping events - IT assignment for Std XI

Perform these tasks on your PC and give yor answers as comments to this post or as an email to my ID - director@abhinav.ac.in . What is the sequence for the events given below and when do they occur for the given object? a) Textbox - Change, KeyPress, KeyDown, Validate b) Command button - Click, GotFocus, LostFocus, KeyPress c) Combo Box - Change, Click, DblClick, DropDown, Scroll Draw an equilateral triangle (should actually look like it) whose one vertex is the point at which the user clicks on the form. Make a simple calculator which has buttons for different numbers & operations (+, -, *, /, ^) and a box to display the result of each operation as well as each number being typed.

Good show at the Baltic Sea Competition

On the auspices of the UNESCO Philosophy Day (19th Nov), Finland organizes a Philosophy competition for countries around the baltic sea. Since 2008, India also sent entries to this competition. Students are supposed to write an essay on 1 out of 4 topics given in a supervised span of 2 hours. The local organizer is then supposed to select 2 of the best essays and send them across to the Finnish organizers, who then go throug ha rigorous process of filtering the essays, quite similar to the International Philosophy Olympiad and declare the medals. Those who miss the medal by a very short difference are given an Honorable Mention. The result for this year has been good for India with Chitra Adkar (SYJC Ramnarain Ruia College, Matunga) getting Bronze and Prathamesh Kubal (SYJC, Abhinav Vidyalay & Jr. College, Dombivli) getting the Honorable Mention. Details will be shortly put up on the organizers web sites. The topics for essay this year were: 1. ”The misfortune of a republic is whe

International Philosophy Olympiad 2008

Hi all, I am very happy to announce to the Abhinav family that two girls from our school represented India in the Int'l Philosophy Olympiad held at Iasi, Romania between 18th & 22nd May 2008 and that contrary to everyone's expectations, they performed exceedingly well . The overall result was that Vallari Sawant (XI, presently at St. Xavier's College) stood 14th missing the bronze medal by just 0.1 mark, and secured a Honorable Mention for her talent, while Chitra Adkar (X) secured a special award by ranking 23rd from amongst almost 60-odd students from about 24 countries. I must say that this is a incredible achievement for these girls since this is the first time India has participated in this Olympiad organized by the Federation of International Philosophical Societies which runs under the aegis of UNESCO. This was the 16th year of the Olympiad which primarily is a test of talent for high school students in the field of philosophy. What is more interesting is that t