Saturday, 19 October 2013

Source-code errors found during compilation

There might be questions in CIE from chapter 3.2 asking about errors found during lexical, syntax and semantic stages of compilation. Below I describe found errors

Errors during Lexical Analysis:
There are relatively few errors which can be detected during lexical analysis.

a) Strange characters
Some programming languages do not use all possible characters, so any strange ones which appear can be reported. Note however that almost any character is allowed within a quoted string.

b) Long quoted strings (1)
Many programming languages do not allow quoted strings to extend over more than one line; in such cases a missing quote can be detected. Languages of this type often have some way of automatically joining consecutive quoted strings together to allow for really long strings.

c) Long quoted strings (2)
If quoted strings can extend over multiple lines then a missing quote can cause quite a lot of text to be 'swallowed up' before an error is detected. The error will probably then be reported as somewhere in the text of the next quoted string, which is unlikely to make sense as part of a program.

d) Invalid numbers
A number such as 123.45.67 could be detected as invalid during lexical analysis (provided the language does not allow a full stop to appear immediately after a number). Some compiler writers prefer to treat this as two consecutive numbers 123.45 and .67 as far as lexical analysis is concerned and leave it to the syntax analyser to report an error. Some languages do not allow a number to start with a full stop/decimal point, in which case the lexical analyser can easily detect this situation.

Errors during Syntax Analysis:
During syntax analysis, the compiler is usually trying to decide what to do next on the basis of expecting one of a small number of tokens. Hence in most cases it is possible to automatically generate a useful error message just by listing the tokens which would be acceptable at that point.

Source: A + * B
Error:  Found '*', expect one of: Identifier, Constant, '('
More specific hand-tailored error messages may be needed in cases of bracket mismatch.

Source: C := ( A + B * 3 ;
Error:  Missing ')' or earlier surplus '('

Errors during Semantic Analysis
One of the most common errors reported during semantic analysis is "identifier not declared"; either you have omitted a declaration or you have misspelt an identifier.
Other errors commonly detected during semantic analysis relate to incompatible use of types, e.g. attempt to assign a logical value such as true to a string of characters. Some of these errors can be quite subtle, but again it is easy to automatically generate fairly precise error messages.

Source: SomeString := true;
Error:  Can't assign logical value to character string
The extent to which such type checking is possible depends very much on the source language.

PL/1 allows an amazingly wide variety of automatic type conversions, so relatively little checking is possible.

Pascal is much more fussy; you can't even assign a real value to an integer variable without explicitly specifying whether you want the value to be rounded or truncated.

Some compiler writers have argued that type checking should be extended to cover the appropriate units as well for even more checking, e.g. it doesn't make sense to multiply a distance by a temperature.
Other possible sources of semantic errors are parameter miscount and array subscript miscount. It is generally an error to declare a subroutine as having 4 parameters and then call that routine with 5 parameters (but some languages do allow routines to have a variable number of parameters). It is also generally an error to declare an array as having 2 subscripts and then try and access an array element using 3 subscript.

O, AS & A Level Computers FREE Resources

Discussion Groups:
A Level: https://www.facebook.com/groups/computing9691/
O Level: https://www.facebook.com/groups/olevelcomputer/
Fan Pages:
A Level: https://www.facebook.com/ALevelComputer
O Level: https://www.facebook.com/OLevelComputer
Websites:
A Level: https://sites.google.com/site/computing9691/

Saturday, 22 June 2013

10 Advices for Students to Choose the Best Teacher


Tuitions are very popular choice of students for revisions. When deciding for a teacher, every teacher is not the same. It is not necessary that the teacher your friends go to is also the best for you. Teachers have different adopted ways of teaching and most stick to the same method for years. For a teacher it might be the proven method but for you it may not work.



Learning with a teacher is not about just taking their lectures but it's an art that comprises of many facets. Following are ten advices to follow when choosing a teacher for tuition.

#1 Word of mouth: 

Hear what others say about a teacher. That friend, class fellow or acquaintance might have an excellent experience in person or their someone had it in past. Word of mouth definitely helps choosing a good teacher but not all teachers are best suited to everyone.

It is not at all necessary that others' good experiences stand true for you too.

No doubt they are generally good and how well they make you learn a topic is your and that teacher's mutual understanding level.
So, ask for demo classes; sometimes multiple classes over sometime to finally decide for it.

#2 Monthly fee and discounts:

Many teachers with ownership, influence and bigger turnout at their respective centers are able to give discounts. Ask for it only if you really need it and make your parents happy about it.

Mostly teachers are generous and they consider discount requests.

You may bargain for discounts on the basis of your referrals, past results, multiple subjects studying at respective center, sibling already studying with the same teacher or for lump sum tuition fee payment.

#3 Access to the tuition center: 

Always choose a tuition center close to your home, school or another center you are already attending. Longer commutes especially by public transport or walk derail students from learning curve and it only becomes a method of attending the class with fatigued mind.

Pushing you and pushing too much stale learning process especially when it is being repeated for months.

Another matter of concern might be the cluster tuition classes in evenings and especially after school. Sometimes because of the company, non-availability of same subject classes on different days or commute hassle, students tend to take cluster or consecutive classes.  Ask your teachers if they are available for tuition classes on other days, other centers or different timings so you could find a balance between school, tuition lectures and self-studies to achieve ultimate goal of learning.

#4 Teacher's availability and his resources online: 


This is information age, things are available 24/7 online, bigger online discussion groups from different domains interacting, time limit and day/night is no longer a barrier. In such a case, if your teacher has available online resources like his own presence online, videos, assignments, presentations, revision notes, after class support material, feedback system or something that helps you readily and in time is a must nowadays.

Online videos is a new buzzword and many teachers are trying to have their class videos uploaded for extra support.

Mostly traditional teachers are reluctant to provide online resources due to their very busy schedule, lack of technology usage or out of the fear of being copied by other teachers etc.
Some teachers are more than teachers; may be as mentors, counselors, friends and facilitators; explore them. Sign up for your favorite teacher's online resources' updates like email newsletters, blog feeds or fan page notifications etc.

#5 Teacher's availability after the class (Extra classes): 

Sometimes it is not enough to have regular classes and students may require teacher's extra time for their doubt clarification. Ask your teachers at the beginning of session about the method to get their extra time regularly to excel the subject.

#6 Any resource available other than class lectures and at what price?

Many teachers provide their notes, handouts and assignments for extra practice & support. Ask your teachers regularly for such and beware that few centers/teachers charge for the same. In case you are being charged, find someone who already has those printed resources or ask for concession.

#7 Free consultation: 

It's not always about subject related quest that you seek but sometimes you or your parents need to discuss, know or explore about a particular subject's efficacy for your future endeavors. Many subjects are compulsory to pursue further education at university level in the desired field and then into your future profession. On contrary few subjects are made mandatory to be taken by the government, education department, foreign boards and local equivalency giving bodies (like IBCC in Pakistan). Few students also opt for additional subjects for the purpose of learning or to increase the possibility of getting scholarships by scoring higher number of ‘A’ grades.
Talk openly to teachers about your subject choice and its impact on your future life. Many teachers eagerly talk about this and hey, this consultation is free. Never miss such opportunities as every piece of information is essential for your successful career. Never miss on any open house or parent teacher meeting.

#8 Exam preparation techniques: 

Usually completing syllabus with your teacher is not good enough for the upcoming CIE. This is just the first step. Teachers have multiple resources and Pandora box full of techniques to prepare you for the exam. This list may include time management, fast writing, classification of questions for determining their sequence for attempt in exams, how-tos for spending time before exam, topical questions, most/least appearing topics and this list goes on….
Ask your teachers for proper exploration of such techniques and their implementations in exam. Such techniques must be adopted and properly applied in exams.

#9 Provision for quick syllabus revisions right before exam: 

Many teachers offer usually one or two day long duration classes to cover the whole syllabus. Such refresher classes are absolutely necessary to have. In case your very teacher is not up to it then find a teacher who does it and have these classes from them even if you may have to pay for these workshop sessions or classes.

#10 Teacher's past results: 

Results do speak for the teacher’s efficacy but not always. It's a good indicator to look for before starting a tutoring session with the teacher.
Remember we live in a mix abilities society and none of the teacher is able to produce all A grade students. Teachers look for the subject ability in you and try improving it. So look for the CIE results in terms of students’ satisfaction, improved previous results and exam passing rate. Usually the best students produce distinction and every teacher has them. There is no harm asking teacher about any distinctions produced by their students.

By: Zafar Ali Khan
========================

Zafar Ali Khan [ZAK] is an O/A level Computer Science Pakistani educator, entrepreneur, and former programmer. He supports a free online education platform www.zakonweb.com to impart O and A level resources. His resources include notes, video lectures, online discussion groups, an artificial intelligence based virtual assistant, upcoming Android and IOS based apps and a website.

ZAK is teaching a wide spectrum of learners, mainly focusing on Computer Science 2210 and 9608. ZAK has a stellar online following, which is evident from his 50,000+ online followers. These exist wherever CIE is offered.

ZAK has taught in many auspicious and renowned institutes throughout Karachi for the past 18 years. His teaching methods coupled with his most innovative digital resources helped students achieve outstanding grades including distinctions in CIE. ZAK is an associate of The Mauritius Institute of Education (MIE), which is a Parastatal body, working under the aegis of the Ministry of Education and Human Resources of Mauritius. ZAK's yearly seminars and one-day marathon classes are very famous among the learners.

Before opting for a full-time teaching profession, ZAK has had the privilege of being associated with renowned public and corporate organizations. He has worked in a diversified array of the large local and international corporations both as a part of them and as a consultant. This wide array of organizations commence from Pakistan Army Engineering Corps to the Galileo Emirates, Dubai and The Acutus NY, USA. Industries that ZAK has experienced with, before opting for a teaching profession, are engineering, pharmaceutical, digital video R&D and customer reservation system (CRS). His expertise as application developer, IT administrator, project manager and IT teacher in a wide variety of business applications has always helped him in innovating teaching styles and resources.

ZAK can be reached at:

Saturday, 2 March 2013

P2 Observations required to be considered when appearing for CIE exam.

Following are the points need to be considered when you are finished with the P2 syllabus.

1. STRING MANIPULATION
A. Dealing with string as an array
B. Dealing with string with respect to ASCII

2. FLOWCHART: Every flowchart in paper 2 that is required to be converted to its pseudocode or source code is a function or procedure.

3. FILE MANIPULATION: It is always in pseudocode & requires mostly assumptions.

4. SCREEN/REPORT DESIGNING: Allocated marks are increasing so more practice is required.

5. NESTING: All loop forms for nesting must be practiced.

6. FUNCTIONS 
A. By value
B. By referance 
(Take help from 3.5)

7. RECURSION: Appear only for dry run

8. ARRAYS: Must be practiced with loops (both simple and nested).

9. RECORD FORMATS (Types, UDT)
A. Files saved with these UDT's.
B. One field in a UDT as an array.
C. UDT variable as an array.
D. Dealing with a record format array when one of UDT's field is an array.
E. As an array of different typed columns; which is not possible with ordinary/simple arrays.

10. Chap 2.5 is always expected to be implemented in all written pseudocodes/source codes as marks are allocated for these practices in marking schemes.


Have a question? See following Resources:
Groups:
A Level: https://www.facebook.com/groups/computing9691/
O Level: https://www.facebook.com/groups/olevelcomputer/
Fan Pages:
A Level: https://www.facebook.com/ALevelComputer
O Level: https://www.facebook.com/OLevelComputer
Websites:
A Level: https://sites.google.com/site/computing9691/
O Level: https://sites.google.com/site/computerstudies7010/