Monday, November 16, 2009

Think First

Recently Conducted a Programming Workshop in Christ College along with Rohini Maam. The workshop would not have been possible without the guidance and encouragement of our department's HOD, Prof. Joy Paulose.

The workshop was conducted on 5,6,7 Nov 2009 the basic objective was to get those students who were not top class in programming to get into the groove.

The workshop included games and team activity. Programming was done as individual and group.

One the final day Clement and Renjith from MindTree shared their programing experiences and gave insight as to how they would do the MCA program if they were given a second chance at college.

The students were very enthusiastic and conducting the workshop was very satisfying.

Some star performers were Jyotsana, Suneesh Thampi, Stanley, Raju and Infanta

Some Programs which the students wrote from scratch without any external help are

Display numbers from 1 to 50
Display even numbers from 2 to 50
Create a square box 10 by 10 filled with asterix
create a square box with asterix only on the perimeter
Make a triangle with asterix starting with 10, then reducing by 1
Make a triangle with asterix starting with 1,then 3,5,7,9 …… it should be centrally alligned like a pyramid
Make a square box like Q3 but leave a plus sign of space in the box
Make a simple plus symbol with asterix of height 10
Write a program to print Fibonacci Numbers
Write a function to insert 10 numbers into an array using scanf
Write a function to DISPLAY ARRAY Content
Write a function to populate array randomly
Write a Function to search in an array for an integer
Write a Function to Binary search in an array for an integer
Print odd numbers from 1 to 51
Depending on input (1 to 10), Tables should be displayed eg if input is 7

7*1=7
7*2=14
7*3=21
If a number is entered , return the sum of digits eg. 324 should return 9 (3+2+4)
Use % and /
Print first 50 Prime Numbers
A prime number is a number divisible by no other number except 1 and itsel
Program to convert your name into ascii characters and print it
Program to find the value of a to the power of n, where a and n are inputted by the user (without using loops)
Program to convert your name to long integer and print it
Program to half your name into two and reverse it eg RAKESH will become KARHSE
Program to find the value of a to the power of n, where a and n are inputted by the user (without using loops)
Convert above programs to individual functions and create a menu to call the above programs


Why do you not give it a try ? Can you do all these programs in under 2 hours ?

Thursday, September 3, 2009

Level 1 Self Certification Results

Correct Entries Received So Far
Pradeeep Kaltari MindTree: 13/14 Q : 1 Hr : 20 Minutes
Marks : 90%
Karan B : Christ University : 14/14 Q: 1 hr 50 minutes
Marks : (Yet To Give Score)

Friday, August 28, 2009

The Way I "C" It

C has been one of my favorite language for a very long time. The book I recommend would always be the book by Kernigan & Ritchie. Costing around Rs 100, this book is a steal by any standards.

The reason I got hooked to this book is much credit to Sunil Batra (my C mentor in London). Since my first cover to cover read in 1999 I have gone to read the book 3 times and have tried almost 90% of the excercises in this book.

Can you answer these questions
Read Pg 107 of KR Book for answers
What is this : Int (*daytab) [13])
What is difference between
Void *comp() and Void (*comp) ()
How many argurments in this function ?
List * CreateList (int (* compare)( void * argu1, void * argu2))
In this snippet do we need bracket arond pLoc and why ?
Node **pLoc
pLoc = (* pLoc ) -> Link;

Pg 209 KR Book
Did you know these are not errors ? What Happens ?

F ( a, (t=3,t+2),c) : How many arguments ?

Sample Code
a=3;
b=5;
a=b,c
Printf(“%d”,c); // What gets printed ??

Is this allowed in a for loop : For i=10,j=1;i<10;i++)

Is this allowed and what is result : b,b,a=3,4,a+2,9;

Pg 98
Int a[10];
Int *pa;
Pa=&a[0];
x=*pa; // what is X
Is *(pa+1) same as a[1]
Is *(pa+i) same as a[i]
Is *(a+i) same as a[i]

Which is error ? Why ?
pa=a;pa++;
or
a=pa;a++;

Sunday, August 23, 2009

Sorting Distribution


I had coded all the Sorting Algorithm for the M.Sc class I am teaching at Christ. This Sunday I gave it a Java Graphic Interface to analyse how the Gaussian Distribution pans out.
This application lets you see 20 Stages of each Sort you run through it

The coding was fun ..... have a look at the 3 Sorts midway in this interface can you identify them ?

Thursday, August 20, 2009

Self Certification

Building with blocks is fun and if somebody told you that you should memorise how to make a bridge or a wall it would seems a bit odd. On the same hand students who have studied Computer Science for 3 years, time again feel memorising the code as the ONLY approach rather than learning how to play with the building blocks of programming.

I have been coding for the last 23 years and I am still doing it because I enjoy it

The objective of this Level 1 Certification excercise is to show a path to start enjoying coding.

Call it a "Self Certification" program, because the only person you really need to convince in life is normally YOURSELF

If you can do these 14 questions yourself, you would not have much problem in your IT career. The experts would be able to solve all 14 questions in 2 hours max. But each of you do it at your pace ..... but do it yourself

Guidelines
Do not refer to any book or any website
Do not ask your peers
Do not refer to some of your earlier code
Start your stop watch for each problem, submit the time taken for each program
A code is considered complete only if it is working when you run and test the program !!!
Primarly placed for students/ professionals from MindTree, Christ University ,CMC or those who know me
Don’t Submit the code in the blog, mail me the answers and time taken (you can also attempt partial set of questions)
Please Note certifcates will NOT be issued :-)
It will take around 3 minutes to 30 minutes to solve each of these problems.

Pre Requisite
Have a PC/Laptop
Install a compiler
Learn how to compile and run a "Hello World" Program
Understand how to code a loop, conditional statement, pass parameters in a function, how to return a value from a function, how to traverse an array before sitting on these problems

Level 1 : Certification (Time Given is for experts .... each one do it at her pace)

1.Print numbers from 1 to 10 (3 minutes)
2.Convert above to a function to take in two numbers (start,end) and print numbers in that range (3 minutes)
3.Print even numbers with using 1 loop and no "if" statement (3 minutes)
4.Write two functions 1 to populate an int array and one to display the int array (4 minutes)
5.Count Vowels in a sentence (assume sentence is stored in an array also store the counts of the 5 vowels in an array) (3 minutes)
6.Count Alphabets in a sentence (assume sentence is stored in an array also store the counts of the alphabets in an array). Can you do it without any "if" or "switch" statement to check the char (7 minutes)

7.Write a function "isPrime" to check if a given number is prime (7 minutes)
8.Optimise Prime Number Program ? Do we have to loop till n ? (7 minutes)
9.Search in the array for a value (4 minutes)
10.Reverse a string array (5 minutes)
11."Print the following pyramid for ""n"" (10 minutes)
If N=1
*
If N=2
*
***

If N=3
*
***
*****
12.Print the following square for "n" (10 minutes)
If N=1
*
If N=2
**
**
If N=3
***
* *
***
13.Binary Search a value (assume the array is sorted) (15 minutes)
14.Implement a deck of cards. (30 minutes)
The cards are stored in an array as integers.
52 Cards, 1 to 13 is spade,14-26 is clubs,27 to 39 is Diamonds and 40-52 is hearts.

  • Implement Shuffle function which randomly shuffles the deck
  • Implement an Init functions which initialises the Deck to 52 Cards
  • DealOne (which deals one card and reduces deck by 1)
  • DealFour( which deals 4 cards and reduces Deck by 4)
DealOne and DealFour can return an integer and array of integers respectively