Upload
fahad-farrukh
View
226
Download
0
Tags:
Embed Size (px)
DESCRIPTION
E-MAG (2nd edition)
Citation preview
IINN DDEE XX
Science and Technology
1. War of Cyberworlds ................................................................................... 8
2. Computer Viruses ...................................................................................... 10
3. One Tonne Baby – The Begining of Modern Computers ........................... 13
4. The Science of Sleep .................................................................................. 15
General Articles
5. Inter Service Selection Boards ................................................................... 18
6. Urban to Urban .......................................................................................... 20
Poetry and Humour
7. My Computer ............................................................................................ 22
8. Twinkle Twinkle ......................................................................................... 23
9. Smile Please ............................................................................... ................ 24
Puzzles – Quizzes – Challenges
10. Test Yourself! ............................................................................................. 26
11. Logical Puzzles ........................................................................................... 27
12. Sudoku ....................................................................................................... 28
13. Programming Challenges ........................................................................... 29
Learning and Information
14. Learning C++ .............................................................................................. 31
15. Explore With Me ........................................................................................ 35
16. Tips n Tricks ............................................................................................... 36
17. Software of the Month .............................................................................. 37
18. Usefull Links ............................................................................................... 38
19. The Constituion ......................................................................................... 39
20. MAG News ................................................................................................. 40
TThhee HHoollyy QQuurraann TT rraa nnss ll aa tt ii oo nn oo ff
MMoo nn tt hh ll yy SS ee rr ii ee ss
[2:1] Alif-Laam-Meem. (Alphabets of the Arabic language; Allah and to whomever He reveals, know their
precise meanings.)
[2:2] This is the exalted Book (the Qur’an), in which there is no place for doubt; a guidance for the pious.
[2:3] Those who believe without seeing (the hidden), and keep the (obligatory) prayer established, and
spend in Our cause from what We have bestowed upon them.
[2:4] And who believe in this (Qur’an) which has been sent down upon you, O beloved Prophet,
(Muhammed - peace and blessings be upon him) and what was sent down before you; and are certain of the
Hereafter.
[2:5] It is they who are on guidance from their Lord; and they are the successful.
[2:6] As for those whose fate is disbelie f, whether you warn them or do not warn them - it is all one for
them; they will not believe. (Because their hearts are sealed - see next verse).
[2:7] Allah has sealed their hearts and their ears, and on their eyes is a covering; and for them is a terrible
punishment.
AL
- B
AQ
RA
H S
ec
tio
n - 1
HHaaddiitthh
[ Sahi Bukhari Volume 1, Book 2, Number 27 ]
[ Sahi Bukhari Volume 1, Book 2, Number 38 ]
[ Sahi Bukhari Volume 1, Book 2, Number 40]
Narrated 'Abdullah bin 'Amr:
A person asked Allah's Apostle . "What (sort of) deeds in
or (what qualities of) Islam are good?" He replied, "To
feed (the poor) and greet those whom you know and
those whom you don't know."
Narrated Abu Huraira:
The Prophet said, "Religion is very easy and whoever
overburdens himself in his religion will not be able to
continue in that way. So you should not be extremists, but
try to be near to perfection and receive the good tidings that
you will be rewarded; and gain strength by worshipping in
the mornings, the nights."
Narrated Abu Huraira:
Allah's Apostle said, "If any one of you improve (follows
strictly) his Islamic religion then his good deeds will be
rewarded ten times to seven hundred times for each good
deed and a bad deed will be recorded as it is."
EE-- MM
AAGG
TTEE A
AMM
EEddiittoorr-- iinn--cchheeiiff
Mian Zeshan Farooqi
EEddiittoorr
Naveed Hamid
CCoo--eeddiittoorr
Ayesha Naeem Mirza
CCoouunnsseell iinngg OOff ffiicceerr
Dilawer Hussain
AAddvveerrtt iissoorr
Mobeen Afzal
RReeppoorrtteerr
Majid Ali
On the way of success…
The first edition of E-MAG was published on
March 1s t, 2009. By the grace of Allah Almighty we
got excellent response from everywhere. Our
teachers, fellows and other readers made us able
to continue publishing E-MAG by encouraging us
and providing us with their valuable feedbacks.
We’ve tried to bring betterments in this edition, in
the light of your suggestions. We’re pleased to
announce that E-MAG is going to publish ‘TWO
BIG SERIES’. One big series was started from the
first edition i.e. Translation of The Holy Quran. The
second BIG SERIES, we’re going to start from this
edition is The Constitution of Pakistan (1973)
Moreover we’re inviting more people to articles
for E-MAG and show off their talent to the world.
Students from different universities and colleges
are showing their interest in writing for this
magazine. We welcome all of you to participate in
E-MAG.
As I said before that your feedbacks are really
important for us. It was the encouragement and
suggestions of people which made us able to
continue this work. Therefore we request you to
please keep on providing us your feedbacks and
suggestions so that we can do better!
Thanks
Editor-in-chief
“In the name of Allah Almighty, the
most beneficent, the most merciful"
EEDDIITTOORRIIAALL
First of all, I would like to congratulate my teachers, colleagues and other
students who showed great interest in the E-MAG and without their
contribution it would be impossible to publish the second edition.
Secondly, I am glad to inform you that the first edition of E-MAG was
successfully published and both the teachers and students appreciated our
effort. In the first edition more than 1000 download were a result of the
quality articles submitted by the students. We also received valuable
feedbacks from the teachers and students as well. We have published their
feedbacks in this edition.
The second edition has been published. In the beginning we used free
hosting but as the number of downloads increased the free quota ended
and readers had to wait for a day so now, we have started our own website
so that there is no downloading problem. You can download your free
copy/copies whenever you want without waiting.
The feedback has helped us a lot in improving the stuff of the mag. We
have included the sections which you suggested in your feedbacks. But as
some of the suggestions were not practical so we have excluded them such
as political and religious articles because as it were a bit controversial.
The second edition covers the articles related to science, technology,
general discussion, stories, challenges, quizzes, puzzles and much more on
the same pattern as in the first edition but with different and wider scope.
I hope you will like the second edition as well. Keep us providing with
your valuable feedbacks.
Editor
Cyberspace is the global domain of electro-
magnetics accessed through electronic
technology and exploited through the
modulation of electromagnetic energy to
achieve a wide range of communication and
control system capabilities. Cyberworlds are
information worlds formed on cyberspace. (Wikipedia)
WWaarr ooff CCyybbeerrwwoorrllddss Written by: Faiza Raana
Forget about James Bond. There is a better, faster, nastier and cleverer spy than you might have ever imagined of: cyberspy.
Curiously, these virtual superspies can make life utterly uglier for our pure-flesh-and-bone spies -- put on super-payrolls --
working round the clock world wide – the CIA, MI6, Mossad – you name it.
This sort of cyber-warfare is hardly a new thing though. When Russians were accused of a cyber-attack on Estonia a couple of
years ago, it came about as a wake-up call for the White House airing concern that America was vulnerable to similar
warfare. And when some in the military sparked suspicion that Chinese cyber spies had already sneaked into unclassified
Pentagon computers, cyber crafts considered starting a chain of cyber command to fight for America's supre macy online.
The $2 billion project, kick-started under the wing of the USAF, was due to
become fully operational later. Ominous adverts about hack attacks on the
Pentagon were commissioned to recruit more men and women. And then, it
was suspended. No reason was given. The notion that modern countries
should consider cyberspace a theatre of war is a no-brainer. It seems like they
have had a lot of political maneuverings over who should run it in the first
place. The question is hardly whether there should be one, but where.
That is barely the only question the USAF Cyber Command had to answer.
People were scarcely sure whether it was there to protect air force assets or
all cyberspaces. Some thought it would only be responsible for computer
networks, while others were convinced that anything that used the electromagnetic spectrum would fall under its purview --
including laser weapons. And no one knows why it was put in charge of both cyberspace and space operations.
Cyber Command came to life in response to millions of attack probes or scans from malicious computers on the Department
of Defence's Global Information Grid (or GIG), encompassing the military's networks, systems
and computers. Evidently, the nature of the threat is large and diverse. It includes recreational
hackers, self-styled cyber-vigilantes and various groups with nationalistic or ideological
agendas, trans-national actors and nation-states. The need for that came when the Pentagon
felt a new section was must because much of the Department of Defence's networks, systems
and computers depend on commercial telecom links and the Internet.
Cyber Command is there to take any military actions in cyberspace. Blowing things up, making them not work, just like in the
real world. It is also offensive and defensive, just like in the real world. But the consequences could be catastrophic too:
potential costs of a multi-critical infrastructure attack on the banking system, the power grid and so on in a sequence
designed to do maximum damage approaches the trillions, and the damage would look like a thousand hurricane Katrinas.
E - M A G
8 Central air conditioners use 98% more energy than ceiling fan.
It is scarcely something a 14-year old could do in his bedroom, however. You would need half a billion dollars and three
years. But that amount of money and time is hardly an absolute barrier to entry -- nation states or trans-national terror gangs
like al Qaeda or even someone like the Russian Mafia, which is not terrorism but organized crime, could certainly pile up that
kind of money.
Several cyber crafts claim Cyber Command is a step in the right direction – up or down it is anybody’s guess: they want to
treat cyberspace as an area for war like a physical space, which is exactly the way to look at it. So is the suspension of Cy ber
Command going to make America more vulnerable? It is hard to answer though many think having someone in charge and
capable of handling the mission is needed urgently.
Many heap blame on political chicanery in the USAF. After scandals about botched
handling of nukes, major contracts going wrong and the firing of the top military and
civilian leaders, the service needs time to regroup before deciding on how to contest
in the cyber arena. But when and if it does come back online, there are still questions
to be answered.
Cyber Command has the right to monitor anything that comes across its own networks, for defence purposes, and there is
hardly any evidence it is going beyond that. Some cyber company titans are worried about how rigorously the American
government will maintain the line between military surveillance and civilian prosecutions.
That sheer scare stems from the army being unable to do the policing duty because there are laws against that, and the USAF
should then hardly be able to check up on civilian cybercrime. The needs of warfare are scarcely the same as the needs of
peacetime -- we barely need howitzers, Predators and B-2 Stealth bombers in peacetime, and we barely need Cyber
Command monitoring us either. Does not the war on terror justify it? They are lying if they say that. They can pretend it is the
same as war, but it is not. The war on terror is just a rhetorical war.
Do you know about Moore’s Law?
The co-founder of Intel Inc. Gordon Moore stated in 1965 that:
“The numbers of transistors incorporate
in a chip will approximately double every
24 Months”
This statement is known as Moore’s Law.
E - M A G
9 In Australia, a dust-devil is called a "willy-willy."
Gordon Moore
CCoommppuutteerr VViirruusseess Written by: Naveed Hamid
Computer viruses is a term which we daily hear in our life but only few of us actually have a technical knowledge about how these
viruses work. This article will definitely help you a lot in understanding what actually a computer virus is and how does it work. A
computer virus is a program which attaches itself to another program to have a drastic effect and it affects software or hardware or
both. This is a definition which we normally hear from our teachers or formally written in the text books but actually a comp uter virus is
an intelligent program which directly communicates with hardware or operating system.
The familiar and well known computer viruses are :
Boot sector viruses
Companion viruses
Email viruses
Logic bombs and time bombs
Macro viruses
Cross-site scripting virus
I will not discuss what do they viruses do and which hardware components and soft wares are being affected because you can find their
details easily in any available text books.
Early history
The first computer virus was written by Rich Skrenta in 1982, and it was named “Elk Cloner” and was spread by floppy disk. The first PC
virus was a boot sector virus written in 1996 by two brothers Basit and Amjad Farooq Alvi operating out of Lahore, Pakistan. Since the
mid 1990’s macros viruses have become common. These viruses are written in scripting languages for Microsoft programs such as Word
and Excel.
Types of computer viruses
Computer viruses broadly classifies in to two categories. One is the “nonresident viruses” and the other is “resident viruses ”.
Nonresident Viruses
A nonresident virus searches for other hosts that can be infected, infect those programs, and then transfers control of that program that
it infected (Britannica). The nonresident viruses consist of two major parts. First one is the ‘fi nder module’ and second one is the
‘replicator module’. The finder module finds the host files to be infected and on finding the host files it calls the replica tor module to
infect those files. For simple virus the replicator’s tasks are:
1. Open the new file
2. Check if the executable file has already been infected (if it is, return to the finder module)
E - M A G
10 It takes eight and a half minutes for light to get from the sun to earth
3. Append the virus code to the executable file
4. Save the executable's starting point
5. Change the executable's starting point so that it points to the start location of the newly copied virus code
6. Save the old start location to the virus in a way so that the virus branches to that location right after its execution.
7. Save the changes to the executable file
8. Close the infected file
9. Return to the finder so that it can find new files for the replicator to infect.
Resident Viruses
Contrary to the nonresident virus a resident virus doesn’t search for programs to infect when its started, it instead loads itself into the
memory when its executed and then transfers control to the host program. The virus then stays active and infects new hosts w hen
those files are accessed (Britannica).
From here resident viruses can be divided into to types of programs, fast infectors and slow infectors. Fast infectors are designed to
contaminate as many files as possible. This specific type of virus can wreak havoc on a virus scanner. If the virus scanner fails to detect
the infected file, that virus can follow the scanner and then infect all the following files that are scanned. The disadvant age relative to
the virus in this case is that infecting that many more files makes it easier to detect, and then subsequently repair (Britannica). Slow
infectors are designed to infect hosts infrequently such as when they are copied. They are designed this way to avoid detect ion by virus
scanners by limiting their actions. Though these specific viruses are harder to detect, they are not as commonly used as fast infectors
using the mentality of infecting as many files as quickly as possible (Britannica).
From here some viruses take action to avoid detection. Some viruses use stealth software by hiding itself until a virus scanner has
passed its file thus seeming that the file is clean and from there infecting the operating system. Other viruses have self -modification
code that, once detected by a scanner, can modify itself and change, allowing the user to delete the infected file but having the modified
virus still on the computer (Britannica).
Other viruses have different code structures and employ them to deter detection by virus scanners. One such code is “polymorphic”
code which infects files with an encrypted copy of itself, which is then decoded by a decryption module (HowStuffWorks). Wit h these
viruses the decryption module is adjusted after each infection making a well written “polymorphic” virus extremely difficult to detect
since it has no parts that stay the same. Another code is “metamorphic” code which rewrites itself completely each time it i nfects a new
program. A “metamorphic” code is usually very large and complex making its detection also extremely difficult (Britannica).
Computer viruses can be broken down into several different types of infections. As stated before a virus is a small software program
that “piggybacks” on real programs. Other types of viruses are e-mail viruses, moving around through e-mail messages and duplicating
itself by automatically mailing itself to several of the people in the victim’s address book. Worms are also a small software program that
uses computer networks such as a business/corporation or a college campus to spread. It scans that network for other machines that
have specific security holes. It copies itself to the new machine using that security hole, and starts to duplicate from the re as well.
Another type of infection is a Trojan horse which is a computer program that claims to do one thing but does another when you run it.
Trojan horses however have no way of duplicating automatically (HowStuffWorks).
E - M A G
11 The United States Mint once considered producing donut-shaped coins.
It’s important to understand that all viruses aren’t initially damaging or destructive to your computer while some are merely annoying,
with the virus being a simple pop up. Other viruses however can erase programs and delete memory. Some of these programs don’t act
immediately and have a delayed payload and can be triggered to be set off like a bomb on a specific day, wait till it has infected a certain
amount of hosts, or until a specific program is run. However once that action is taken the virus is implemented, completing its program
whether that be a small annoying pop up or erasing your entire hard drive (Britannica).
Some people create viruses with negative intentions to harm others. Their purpose is to damage their valuable data and information
while other people create viruses just for the sake of learning. Their purpose is to find bugs in the soft wares and operatin g system so
that these bugs can be removed. Some people claim as computer viruses only harm so they should not be created but for the academic
purposes it is the best way of learning the computer hardware and software and I think that courses related to virus designin g must be
offered in the universities so that students have a better understanding of the technology.
IILLOOVVEEYYOOUU
E - M A G
12 There are approximately 90 people that have been frozen after their death.
ILOVEYOU was a computer virus that hit numerous computers in
2000, when it was sent as an attachment to an email message
with the text "ILOVEYOU" in the subject line. The virus arrived in
e-mail boxes on May 4, 2000, with the simple subject of
"ILOVEYOU" and an attachment "LOVE-LETTER-FOR-
YOU.TXT.vbs". Upon opening the attachment, the virus sent a
copy of itself to everyone in the user's address list, posing as the
user. It also made a number of malicious changes to the user's
system. It caused loss of billion dollars to the world. (Wikipedia)
Replica of SSEM at Museum of Science and Industry at
Manchester
OOnnee TToonn BBaabbyy The Beginning Of Modern Computers
Do you know when the history of computer began? Everyone would answer this question differently. One may say that history of
computer begins from 300-BC with Abacus. This argument might be correct if you define computer as ‘a machine which counts
something’.
Many people consider the Charles Babbage’s Analytical Engine as the beginning of computer history. Babbage’s Analytical Engine was
not a physical machine. It was just an idea of first general-purpose-computer presented by Babbage in 1837. Babbage kept on working
on this design till his death in 1871. After his death, the progress in the field of computer was very slow even almost ended at a time. But
the proverb ‘Necessity is the mother of Invention’ proved when World War II started.
Many programmable computers were built during 1940s decade. Some of them were built to meet the needs of military during the war
while some were later on built with the aim of progress. UK built Colossus and USA built ENIAC. Both ENIAC and Colossus were
programmable computers. ENIAC was built to calculate the trajectory of shells for the US army while Colossus was built to decrypt
messages from the German High Command during World War II. Both ENIAC and Colossus were
reprogrammable but this could take a very long time, even several days, to reprogram these
computers.
On June 21st, 1948 just after 11:00am, the world’s first electronic digital programmable computer
executed its first program successfully at Manchester University. This computer is known as
Manchester Small-Scale Experimental Machine (SSEM) and sometimes as Mark-I Prototype. As it was
the first electronic digital programmable computer with memory storage and it was the beginning of
modern computers so it was nicknamed as ‘The Baby’. It was built at the Victoria University of
Manchester by Frederic C. Williams, Tom Kilburn and Geoff Tootill .
The key feature The Baby was its memory. Cathode Ray Tubes (CRTs) were used to store a program.
A metal grid was attached to the screen to read the different charges. A graphical representation - dashes for a one and dots for a zero -
was displayed on a second CRT wired in parallel to the memory device. Input to the Baby was by setting sequences of bits at chosen
addresses using a simple keyboard. Output was by reading the information on the
Display Tube. The Baby had 32-bits word length and storage of 32 words
(extendable up to 8192). It had a single address format order code and it could
perform serial binary arithmetic operation using 2s complement i.e. it could
perform only one arithmetic operation that is subtraction. It was 5.2 meters long,
2.2 meters high and weighs one tonne! It occupied a whole room. Today’s
calculators are tiny but work much more efficient than The Baby.
The Baby had an instruction set of three bits i.e. it could perform maximum 23 = 8
instructions but it had only 7 instructions:
E - M A G
13 Japan uses the most energy per year than any other country.
A page from Geoff Tootill's notebook
shows a program wri tten for Baby. All
the data and programs had to be
wri tten in 1024 bits
Freddie Williams
Tim Kilburn
Instruction Set of The Baby (SSEM)
Binary code Modern mnemonic Operation
000 JMP S Jump to the instruction at the specified memory address (absolute
unconditional jump}
100 JRP S Jump to the instruction at the specified memory address plus the number
specified (relative unconditional jump)
10 LDN S Take the number from the specified memory address, negate it, and load it
into the accumulator
110 STO S Store the number in the accumulator at the specified memory address
001 or 101* SUB S Subtract the number at the specified memory address from the value in
accumulator, and store the result in the accumulator
11 CMP Skip next instruction if the accumulator contains a negative value
111 STP Stop
*The function bits were only partially decoded, to save on logic elements
The first program was written by Tim Kilburn (one of the creators of The Baby). This program was
consisted of 17 instructions and so far as can be ascertained first ran on 21 June 1948. It was designed
to find the highest proper factor of 218 (262,144) by trying every integer from 218 − 1 downwards. The
divisions were implemented by doing repeated subtractions of the divisor. The SSEM took 3.5 million
operations and 52 minutes to produce the answer (131,072). The program used eight words of working
storage in addition to its 17 words of instructions, giving a program size of 25 words. Geoff Tootill wrote
an amended version of the program the following month, and in mid-July Alan Turing—who had been
appointed as a reader in the mathematics de partment at Manchester University in September 1948—
submitted another program, to carry out long division.
The Baby morphed into the Manchester Mark I and eventually the first commercial general purpose
computer, the Ferranti Mark I. In 1998, a working replica of The Baby, now on display at the Museum of
Science and Industry in Manchester, was built to celebrate the 50th anniversary of the running of its first
program. Demonstrations of the machine in operation are held regularly at the museum.
References: BBC, Wikipedia, University of Manchester
Do you know?
E - M A G
14 Research indicates that plants grow healthier when they are stroked.
The world's largest semiconductor company and
the inventor of x86 series of microprocessors,
Intel, was founded on July 18, 1968 Robert
Noyce and Gordon Moore.
Written by: Mian Zeshan Farooqi
TThh ee SSccii eenn ccee ooff SS ll ee eepp
Why do we sleep?
So why do we sleep? This is a question that has baffled scientists for centuries and the answer is, no one is really sure.
Some believe that sleep gives the body a chance to recuperate from the day's activities but in reality, the amount of
energy saved by sleeping for even eight hours is miniscule - about 50 kCal, the same amount of energy in a piece of
toast.
We have to sleep because it is essential to maintaining normal levels of cognitive skills such as speech, memory,
innovative and flexible thinking. In other words, sleep plays a significant role in brain development.
What would happen if we didn't sleep?
A good way to understand the role of sleep is to look at what would happen if we didn't sleep. Lack of sleep has serious
effects on our brain's ability to function. If you've ever pulled an all -nighter, you'll be familiar with the following after-
effects: grumpiness, grogginess, irritability and forgetfulness. After just one night without sleep, concentration
becomes more difficult and attention span shortens considerably.
With continued lack of sufficient sleep, the part of the brain that controls languag e,
memory, planning and sense of time is severely affected, practically shutting down. In
fact, 17 hours of sustained wakefulness leads to a decrease in performance equivalent to
a blood alcohol level of 0.05% (two glasses of wine). This is the legal drink driving limit in
the UK.
Research also shows that sleep-deprived individuals often have difficulty in responding to rapidly changing situations
and making rational judgements. In real life situations, the consequences are grave and lack of sleep is said t o have
been be a contributory factor to a number of international disasters such as Exxon Valdez, Chernobyl, Three Mile Island
and the Challenger shuttle explosion.
Sleep deprivation not only has a major impact on cognitive functioning but also on emotiona l and physical health.
Disorders such as sleep apnoea which result in excessive daytime sleepiness have been linked to s tress and high blood
pressure. Research has also suggested that sleep loss may increase the risk of obesity because chemicals and hormon es
that play a key role in controlling appetite and weight gain are released during sleep.
What happens when we sleep?
What happens every time we get a bit of shut eye? Sleep occurs in a recurring cycle of 90 to 110 minutes and is divided
into two categories : non-REM (which is further split into four stages) and REM sleep.
E - M A G
15 In the United States, the most frequent month for a tornado to occur is in May.
Non-REM sleep
Stage one: Light Sleep
During the first stage of sleep, we're half awake and half asleep. Our muscle activity slows down and slight twitching
may occur. This is a period of light sleep, meaning we can be awakened easily at this
stage.
Stage two: True Sleep
Within ten minutes of light sleep, we enter stage two, which lasts around 20
minutes. The breathing pattern and heart rate start to slow down. This period
accounts for the largest part of human sleep.
Stages three and four: Deep Sleep
During stage three, the brain begins to produce delta waves, a type of wave that is large (high amplitude) and slow
(low frequency). Breathing and heart rate are at their lowest levels.
Stage four is characterised by rhythmic breathing and l imited muscle activity. If we are awakened during deep sleep we
do not adjust immediately and often feel groggy and disoriented for several minutes after waking up. Some children
experience bed-wetting, night terrors, or sleepwalking during this stage.
REM sleep
The firs t rapid eye movement (REM) period usually begins about 70 to 90 minutes after we fall asleep. We have around
three to five REM episodes a night.
Although we are not conscious, the brain is very active - often more so than when we are awake. This is the period
when most dreams occur. Our eyes dart around (hence the name), our breathing rate and blood pressure rise.
However, our bodies are effectively paralysed, said to be nature's way of preventing us from acting out our dreams.
After REM sleep, the whole cycle begins again.
How much sleep is required?
There is no set amount of time that everyone nee ds to sleep, since it varies from person to person. Results from the
sleep profiler indicate that people like to sleep anywhere between 5 and 11 hours, with the average being 7.75 hours.
Jim Horne from Loughborough University's Sleep Research Centre has a simple answer though: "The amount of sleep
we require is what we need not to be sleepy in the daytime."
Even animals require varied amounts of sleep:
E - M A G
16 The speed of sound must be exceeded to produce a sonic boom.
Species Average total sleep time per day
Python 18 hrs
Tiger 15.8 hrs
Cat 12.1 hrs
Chimpanzee 9.7 hrs
Sheep 3.8 hrs
African elephant 3.3 hrs
Giraffe 1.9 hr
The current world record for the longest period without sleep is 11 days, set by Randy Gardner in 1965. Four days into
the research, he began hallucinating. This was followed by a delusion where he thought he was a famous footballer.
Surprisingly, Randy was actually functioning quite well at the end of his research and he could still beat the scientist at
pinball. S o u r c e : B B C
Alzheimer's Eye Test
Count every ' F ' in the following text:
FINISHED FILES ARE THE RE
SULT OF YEARS OF SCIENTI
FIC STUDY COMBINED WITH
THE EXPERIENCE OF YEARS...
How many Fs you count?
.
E - M A G
17 There has only been 193,000 metric tonnes of gold discovered to date.
There are 6 Fs -- no joke. READ IT AGAIN! Really, go back and Try to find the 6 F's before.
The reasoning behind is that our brain cannot process 'OF'. Incredible or what? Go back and look again!! Anyone who counts all 6 'F's' on the first go is a genius
Submitted by: Saad Ahmed
IInntteerr SSeerrvvii cceess SSeelleeccttiioonn BBooaarrdd Written by : Abdul Salam
ISSB is a selection board of the Pakistan Armed Forces. All the selection of officers of armed forces is held under this board.
ISSB acts as nursery for the Armed Forces of Pakistan. Its Mission is to select potential officers for the defense forces of
Pakistan who have the requisite mental, moral, social and dynamic qualities to make successful leaders during peace and
war. The above mission sets a very sacred and tough challenge for the organization which can only be met with true
dedication, selfless devotion and unflinching resolve to set and meet the standards. Inter Services Selection Board follows a
set of time tested protocols to analyze and predict human.
In order to get commission in forces candidates have to be “RECOMMENDED “by the board. Candidates have to pass the
initial exam and later on medical exam at the selection centres of army, navy and air force. The candidates fulfilling the initial
requirements are then called by the board.
Candidates have to stay for 4 days at ISSB for many different tests. The selection technique followed by the ISSB is three
dimensional. All candidates appearing before the ISSB are to take three
different types of tests, i.e., psych tests, GTO tests and Interview. The
Psychologist Officers, Group Testing Officers and the Deputy Presidents, who
are specialists in their respective fields, administer these tests.
Testing Programme
1st Day
Opening Address by a Deputy President Intelligence Tests Announcement of screening out result
Remaining Psychological Tests
2nd Day
Briefing
Indoor Tasks
Group Discussion
Group Planning
Outdoor Tasks
Progressive Group Task (PGT)
Half Group Task (HGT)
Candidates at Conference day
Candidates during test
E - M A G
18 The longest recorded duration of a total solar eclipse was 7.5 minutes.
3rd Day
Individual Obstacles
Command Task
Final Group Task (FGT)
Interviews
4th Day
Conferences
Preparation of all the results
Dispersal of candidates
After taking so many different tests, all the respective officers that are observing the candidates held conference where they
discuss the suitability of the candidates for the RECOMMENDATION to the respective headquarters. After the recommendation candidates are called for final medical tests and then clearing the test will result in the joining letter to the Pakistan Military Academy, Air force Academy Risaalpur, & Pakistan Naval Academy.
DDeeffeennddeerrss ooff PPaakkiissttaann –– OOuurr PPrriiddee
E - M A G
19 Travelling by air is the safest means of transportation.
UUrrbbaann ttoo UUrrbbaann
Written by: Sami Haroon GC University, Lahore
I'm standing in the scorching heat in a sweat soaked shirt and dress pent. I look at my watch 12:30 pm. I'm waiting for the
local bus to reach a debating camp at Government College University Lahore. Let me enlighten about the fact that I used to
reach the University by its own transport, until a strange rule was imposed on us that would not allow us to gossip with even
the boys. That was when my association with the University transport ended. 'Long Live Local Busses!' wa s my slogan. I was
so wrong.
Here it comes, the 40 brutally carved at the head of the bus. I stick out a hand to remain it to stop, but the speed which it
approaches me scares me into pulling my hand back. Suddenly, it comes to a screeching halt, which al most leaves me deaf.
"Wapda Town, Lari Adda!!" the conductor shouts repeatedly and as I stick one foot into the bus, a man sitting by the
window spits paan on my new shoe and shows me a weird expression that I interpret as an apologetic smile. The bus pulls
away and I yank my spoiled shoe inside to save my leg from the passing traffic.
It's a fish market inside. My dad says, 'Son, one has to strive a lot to make his place in society'. I must be making my father so
proud because I really have to strive to find a little space for myself inside the moving fish market.
Here I am, standing, holding onto the rusting, breaking, railing separating the males from the females, both feet stuck under
the railing to hold on. I sigh deeply. The passengers will make a Maulvi proud. They are standing in a great show of
brotherhood, shoulder glued to each other.
I glance at the passengers and notice that they are giving weird looks to my dressing. I study my clothes. I don't see anything
wrong with them. May be they were not expecting a man with suit, who looks like he accidentally fell into a tub of starch
before joining the mobile fish market.
By now, I'm dying to sit. The man sitting by my side stands up and I breathe a deep sigh of relief. I'm just about to sit, when
I'm rudely pushed from the opposite side and a man jumps over several heads to land into the seat. He looks happy like he's
just dethroned Mushraf or something. It's happened so quickly, I'm wondering if maybe we finally have something with
which light travels, he is not unkind, he offers me to sit in his lap, but I just smile stiffly and turn away.
The bus stops at an unknown stop. This is nothing extraordinary. Everyday there is a new stop. A strange creature boards the
bus. It has long hairs, a long beard, dirty white shalwar kameez. The shalwar hangs about 5 inches above his ankles.
The creature is still. Suddenly it wipes its face on its chaadar and shouts, 'Attention respected passengers! Respected
passengers, I am here to tell you that there is only one God, Allah. We worship only one God and Prophet Muhammad
(S.A.W) is Allah's last Prophet. I am here to tell you . . . ` the shouting match reaches half time. It takes something out of its
bag and the shouting match resumes. 'This is a needle! I am here to tell you that this is a special needle and I guarantee that
if you buy even one of the these special needles, you will get very close to God. Right now, it is selling for 10 rupees in the
market. I am here to tell you that it is only for 5 rupees in my hand. Buy them and get close to God.
E - M A G
20
How much we understand the sign boards?
.
I smile myself. What nonsense! Who would buy it? I get my answer instantly because suddenly the fish market turns violent
as waves of men shove their 10 rupees notes forward to buy a one-way needle to God.
A man standing by my side shivers. I turn to him and he looks horrified as though I have slapped him. Then he reaches into
the pocket of his kameez and while he keeps staring at me, pulls out what I was think is going to be a gun to shoot me with.
But it's a mobile. 'My mobile is vibrating.' I don't know why he is telling me this. 'I bought this from Shah Almi for 2,325
rupees only and you know, it has a camera too. Isn't great? 2,325 only!! I nod in reply and then he asks which mobile I have,
but suddenly the conductor yells 'Katcheery!!' and I push my way to the door, swimming along with the tide.
The mobile body of flesh, sweat and dirt spits me out much like the paan I started my journey with and as I regain my
balance, I check to make sure all parts of my body have landed with me.
I reached my destination at last. But before going to the debating camp, I went to the transport office for my new bus card.
E - M A G
21 The stapler was invented in Spring Valley, Minnesota.
Photograph by: Moonis Ahmed, UET, Lahore
MMyy CCoommppuutteerr By: Burmah M. Teague
My computer has a language
That is foreign to me
It speaks of RAM and Gigabytes
And what could ROM be!
I don't understand the Windows
My computer says are there
Nor the Gem Clip at the side of my page
With eyes that blink and stare!
I don't understand the cures
That maintenance wizards do
It's called defragmenter, scan disk,
And virus cleaning too!
Yet, computer and I work hand and eye
With a mouse to translate
The tasks that I want it to do
While it points out my mistakes!
E - M A G
22 A cesium atom in an atomic clock that beats over nine billion times a second.
Su b m i t t ed b y : D i l a wer H u s s a in
TTwwiinnkk llee TTwwiinnkk llee
E - M A G
23 Hydrogen is the most common atom in the universe.
Twinkle, twinkle, little star,
How I wonder what you are!
Up above the world so high,
Like a diamond in the sky!
Following stanzas are also part of this rhyme but
only few of us might ever read these stanzas
When the blazing sun is gone,
When he nothing shines upon,
Then you show your little light,
Twinkle, twinkle, all the night.
Then the traveller in the dark,
Thanks you for your tiny spark,
He could not see which way to go,
If you did not twinkle so
In the dark blue sky you keep,
And often through my curtains peep,
For you never shut your eye,
Till the sun is in the sky
As your bright and tiny spark,
Lights the traveller in the dark,—
Though I know not what you are,
Twinkle, twinkle, little star
Do you know?
The poets of this poem were two sisters Ann Taylor (1782-1866) and Jane Taylor (1783-1824). This poem was
first published in 1806. It is often sung to the tune of the French melody "Ah! vous dirai-je, Maman" which was
published in 1761.
SSmmiillee PPlleeaassee
E - M A G
24 One tree can filter up to sixty pounds of pollutants from the air each year.
Never put off the
work until tomorrow
- what you can put
off today!
E - M A G
25 The first domain name ever registered was Symbolics.com on March 15, 1985.
A person turned on the computer without a
keyboard plugged in.
When she turns on the computer, the computer
finds out that there is no keyboard attached
and it gives a "Keyboard Error" message.
She then asks "Why did it give me a keyboard
error?
There isn't even a keyboard attached?
I was thinking of
becoming a doctor.
I have the
handwriting for it.
A modern artist is one who
throws paint on canvas,
wipes it off with a cloth
and sells the cloth.
TTeesstt YYoouurrsseellff!! Submitted by: Mobeen Afzal
Continue the following sequence in a logical way:
M T W T _ _ _
Correct this formula with a single stroke:
5 + 5 + 5 = 550
Please write anything here:
___________________________________
Draw a rectangle with 3 lines:
E - M A G
26 The USSR launched the world's first artificial satellite, Sputnik 1, in 1957.
Note: Answers will be published in next edition.
Submit your answers at [email protected] before April 25, 2009
Your name would be published in next edition of E-MAG if you submit correct answers
This test has been taken from a test paper of A Level.
Solutions of
Logical Puzzles By: Saad Ahmed
If it were two hours later, it would be half as long until midnight as it would be if it
were an hour later. What time is it now?
9 p.m.
One brick is one kilogram and half a brick heavy. How heavy is one brick?
There is an easy equation which can help: 1 brick = 1 kg + 1/2 brick And so 1 brick is 2 kg heavy.
A table tennis ball fell into a tight deep pipe. The pipe was only a bit wider then the ball, so you cannot use your hand. How would you take it out, with no damage?
All you have to do is pour some water into the pipe so that the ball swims up on the surface.
A man lives on the tenth floor of a building. Every morning he takes the elevator down to the lobby and leaves the building. In the evening, he gets into the elevator, and, if there is someone else in the elevator - or if it was raining that day - he goes back to his floor directly. Otherwise, he goes to the seventh floor and walks up three flights of stairs to his apartment. Can you explain why it is so? (This is probably
the best known and most celebrated of all lateral thinking puzzles. It is a true classic. Although there are many
possible solutions which fit the initial conditions, only the canonical answer is truly satisfying.)
The man is a midget. He can't reach the upper elevator buttons, but he can ask people to push them for him.
How can you throw a ball as hard as you can and have it come back to you, even if
it doesn't hit anything, there is nothing attached to it, and no one else catches or
throws it?
Throw the ball straight up in the air.
E - M A G
27 The width of a tornado can range from less than ten yards to more than a mile
Sudoku is a number placement puzzle. The objective is to place digits in 9 x 9
grid such that digits from 1 to 9 occur once in each row, each column and each
3 x 3 boxes (blocks). Some numbers are already given at random places. Player
has to fill the remaining boxes according to above constrain.
Solution of last month
Correct Solution Submitted by:
Aamna Yousaf Mir - 06-poly-07 - UET, Lahore
Muhammad Rizwan Asghar - BCSS02A023 - PUCIT
SSUUDDOOKKUU
8
7 3
4 5
2 1
4
3 6
8 5
9 5
2
3 6
1 8
4 9
7
8 3 4 7 6 5 1 2 9 1 7 5 8 2 9 3 4 6
6 9 2 1 4 3 7 8 5 4 6 8 3 9 7 5 1 2
7 2 3 5 1 6 8 9 4 5 1 9 2 8 4 6 3 7
3 4 6 9 5 1 2 7 8
2 5 1 4 7 8 9 6 3 9 8 7 6 3 2 4 5 1
E - M A G
28 The only commercial aircraft that is able to break the sound barrier is the Concorde
Note: Solution of above Sudoku will be published in next edition.
Submit your answers at [email protected] before April 25, 2009
Your name would be published in next edition of E-MAG if you submit correct answers
PPrrooggrraammmmiinngg CChhaalllleennggeess By: Mian Zeshan Farooqi
1. Simply add a single character in the following co de such that it prints Long Live
Pakistan o nly one time. Yo u’re not al lowed to modify or remove any character.
2. Write a progr am which takes two positive integers from user and displ ay the
greater o ne . You’re not allo wed to use < or > operator in your co de.
3. Write a progr am which dis plays 0 i f the given integer is even and 1 if odd.
You’re not allowed to use any arithmetic operator . By: Dil awer Hussai n
4. I was said to write a progr am which prints 786 on scr een. By mistake I added &
operator in co ut statement. Now as a penalty I ’m not allo wed to remove or
modify anything from my co de. I’m said to fix this mistake by adding one more
character in the fo llowing code . Which char acter sho uld I add to print 786 o n
screen?
E - M A G
29 Every day, the Hubble telescope transmits enough data to fit 10,000 standard computer disks.
#include <iostream.h> void main () {
for ( int i = 0; i < 10; i++ ) cout<<”Long Live Pakistan”;
}
D iff ic ul ty : 1
#include <iostream.h> void main () {
int var = 786; cout<<&var;
}
Note: Answers will be published in next edition.
Submit your answers at [email protected] before April 25, 2009
Your name would be published in next edition of E-MAG if you submit correct answers
SSoolluuttiioonnss ooff PPrrooggrraammmmiinngg CChhaalllleennggeess
((11sstt eeddiitt iioonn))
Change the following code to print ASCII of ‘A’. You’re allowed to add/remove or edit
maximum five characters in the following code.
Change the following code to print ‘I Love Pakistan’ ten times. You’re allowed to add/remove
or edit maximum one character in the following code.
E - M A G
30 The Great Comet of 1843 had a tail that was over 300 kilometres long.
#include <iostream.h> void main () {
int ch = ‘A’;
cout<<ch; }
#include <iostream.h> void main () {
char ch = ‘A’;
cout<<(int)ch; }
Correct Solutions Submitted By:
Ali Younas – BSEF07A010 – PUCIT Samia Amjad – BITF08M036 – PUCIT
Muhammad Rizwan Asghar – BCSS02A023 – PUCIT Muhammad Ammar Aslam – BSEF07A037 – PUCIT
#include <iostream.h> void main () { int n=-10; for(int i=n; i<0; i++) cout<<”I Love Pakistan”; }
#include <iostream.h> void main () { int n=10; for(int i=-n; i<0; i++) cout<<”I Love Pakistan”; }
Note: If you want to discuss these problems then you can contact me at [email protected]
Correct Solutions Submitted By:
Ali Younas – BSEF07A010 – PUCIT Muhammad Ammar Aslam – BSEF07A037 – PUCIT
D iff ic ul ty : 1
Table 2.1
sizeof() function takes one parameter i.e. data type or variable and returns its size in number of bytes. For example if you execute the following
code on BC++ then it will display 2 which means int takes 2 bytes under environment of Borland C++
void main () {
cout<<sizeof(int);
}
Learning C++
By: Mian Zeshan Farooqi
In the previous episode, we learnt some basic concepts of C++. We learnt to include header files, displaying something on scr een,
clrscr() and getch() functions, stream insertion operator <<, use of endl and a escape sequence ‘\n’. In C++ \ is known as escape
character. Some character is when combined with this \ then it is (as a whole) known as escape sequence. We use escape sequences in
strings for output. When compiler encounters an escape sequence, it doesn’t print that, instead it performs some specifi c task. Some
commonly used escape sequences are given in Table 2.1 with their corresponding functionality. I would advice you to use these escape
sequences in your programs to beautify their outputs.
Now let’s move towards the input operations and memory concepts. Input means to take the response from user (via keyboard, mouse,
etc) or from some file or other source. Before going into
details, let us take an example from our daily life.
Consider that you want to drink juice of oranges today.
You have oranges and a juicer machine with you, is it
enough? Think upon it! Would you put the oranges in
juicer machine, extract the juice and put your mouth in
front of machine to drink the juice? Obviously as a
civilized person you would not do like that. You would
take some glass and extract the juice in it and then drink
that juice. So being more generalize we can say that you
would take some container and pour the juice into it.
Now this container might be a class or a bottle or
anything else. It means that we always need a container to keep something. Same like that in C++ we need some container to store the
data for our program. Now what could be that container? Should I take some glass or a bottle like above example to store the data for
my program? Obviously not! We can’t use same thing for different situations. Here I would need some free memory location to store my
data. We can find free memory locations in main memory (i.e. RAM) or hard disk or any other storage device. As you know that
Operating System loads every program in main memory, so it allows us to store our data temporarily in main memory during the
execution of our program.
What we do is that we occupy some memory locations temporarily in main memory and name those locations. These named memory
locations are known as identifiers. We also define attributes of identifiers e.g. which type of data it can store, life time, etc. Occupying
space and assigning it some name is known as declaration of identifier. While assigning it some initial value is known as its initialization.
An identifier whose value can never be changed (after initialization at the time of declaration) is known as a constant identifier or simply
as a constant. Those identifiers whose value can be changed any time during
execution of program are known as variable identifier or simply as a variable. Have a
look at the following code:
1. void main () 2. { 3. int a; 4. const int b = 123; 5. a = 10; 6. }
Escape sequence
Name Description
\n New Line Moves the cursor to the start of next l ine.
\t Tab Moves the cursor one tab ahead .
\r Carriage Return Moves the cursor to the beginning of current line.
\a Alert Produces a beep from PC Speaker.
\b Backspace Moves the cursor one character reverse.
\\ Backslash Prints a backslash.
\' Single Quote Prints a single quote.
\" Double Quote Prints a double quote.
E - M A G
31 The United States has paved enough roads to circle the Earth over 150 times.
Episode # 2
A constant identifier can never contain
a garbage value because we’re bound
to initialize it at the time of declaration.
A valid C++ identifier name starts with
an alphabet or underscore and
preceding characters can be letters,
digits or underscore. You can not use
a keyword as an identifier name.
Valid names Invalid name
abc 123 var1 1var temp_1 temp 1 _sum sum!
A modifier is a keyword which is used to
modify the default meaning or use of a
basic data type. A modifier is always
placed before the data type in declaration.
In line 3 we’ve declared a variable identifier of name a. The first word of line 3 int is telling the compiler that which type of data a can
store. It is known as data type of an identifier. There are some basic data types in C++
which are known as built-in data types. These are int, char, float, double, void. int stores
an integer value like 123, char stores a single character like ‘A’ and float contains a decimal
value like 123.456. At this level you can consider double as an enhanced form of float. void
is usually used only as a return type of function because it holds nothing. There’re some other built-in data types like wchar_t but we’ve
no need to focus on them at this level.
Size and range of these data types varies from machine to machine. You can use sizeof() function to determine the size of a data
type. In this case data type of a is int that is indicating that a can store an integer value. The size of a in memory is automatically
determined by the compiler. Initially a contains an unknown value which is known as garbage value.
In line 4 we’ve declared a constant identifier of integer type named as b. Here const is an
access modifier of identifier b which means that value of b can never be changed. It
means we must assign some initial value at the time of declaration of a constant
identifier. While you can initialize any non-constant identifier (variable) at any time
during the execution of program, as we’ve declared a at line 3 and initialized it at line 5.
Note that we’ve to specify the data type of an identifier only at the time of its declaration, after that we can access the occupied
memory location simply with the name of its identifier. So line 5 will place 10 at the memory location whose name is a.
You can’t declare multiple identifiers of same name in same block. For example consider the following code
1. void main()
2. {
3. int var2;
4. int var2 = 10; //error – var2 is already declared
5. }
You can create multiple variables of same data type with comma separated list or in separate lines. Its totally upto you either you initialize all of them ,few of them or none of them at the time of declaration. See the following code:
1. void main()
2. {
3. int num1, num2 = 5, num3 = 0, num4, num5, num6;
4. char name1 = ‘A’, name2, name3, name4, name5 = ‘F’;
5. float alpha = 2.2, beta = 3.243, gamma = 9.999;
6. int var = -10;
7. } You’ve created total 7 int type variables out of which 3 are initialized. 5 char type variables out of which 2 are initialized and 3 float type variables and all of them are initialized at the time of declaration.
E - M A G
32 The iron disulfide (Pyrite) is considered "fool's gold" because it looks very similar to gold.
A keyword is a word reserved by the
language to provide various
features. A keyword has can not be
used as an identifier. You can get the
list of C++ keywords from E-MAG
website. http://emagportal.com
Table 2.2
There are some data type modifiers named as unsigned, signed, long, short. The modifiers signed, unsigned, long, and short can be applied to integer base types. In addition, signed and unsigned can be applied to char, and long can be applied to double. All combinations and effects of using these modifiers are given in table 2.2. Now I would like to introduce two more concepts i.e. scope of an identifier and life time of an identifier. Life time of an identifier is the
duration for which it exists in the memory. Scope of an identifier is the area of your source code in which you can access that identifer.
We’ll learn both these concepts side by side. Consider that you’ve two functions in your program, one is main() and other is myfun().
A variable a is declared in main () and another variable b is declared in myfun(). Now you can’t access a in myfun() and it is also
not possible to access b in main(). Such identifiers which are accessible only in the block of code ( area between { and } ) in which they
ware declared, are known as local identifiers. While such identifiers which are accessible anywhere in the source code, are called global
identifiers. Have a look at the following source code:
1. #include <iostream.h> 2. 3. int var1 = 10; //global variable 4. void myfun()
5. {
6. int var2 = 10;
7. var1 = 123; // allowed
8. var3 = 20; // error – undefined symbol var3
9. }
10. void main ()
11. {
12. int var3 = 10;
13. var1 = 10; // allowed
14. var2 = 20; // error – undefined symbol var2
15. }
In above example we’ve declared a global variable var1 at line 3. var1 is accessible to both main() and myfun(). var2 is
declared in myfun() and var3 is declared in main(). You can see that we’re unable to access var2 in main() and var3 in
myfun(). This is because var2 is declared in block of myfun() so it is accessible only in that block and same is the case of var3.
Now let’s have another example to better understand the scope of a variable. Consider the
following code:
1. void main () 2. { 3. //create a logical block of statements
4. { 5. int a = 2; 6. } 7. cout<<a; //error – undefined symbol a 8. }
Type Size
(bits) Range
char 8 –12 8 to 1 27
unsigned char 8 0 to 25 5
signed char 8 –12 8 to 1 27
int 16 –32, 76 8 to 3 27 67
unsigned int 16 0 to 65 53 5
signed int 16 –32, 76 8 to 3 27 67
short int 16 sa me a s in t
unsigned short int 16 sa me a s u ns i gne d in t
signed short int 16 sa me a s sh o rt i n t
long int 32 –2,1 47 ,48 3, 648 to 21 47 48 364 7
unsigned long int 32 0 to 42 94 967 29 5
signed long int 32 –2,1 47 ,48 3, 648 to 21 47 48 364 7
float 32 3.4E –3 8 to 3. 4E+ 38
double 64 1.7E –3 08 to 1.7E +3 08
long double 80 3.4E –4 932 to 1. 1E+ 493 2
E - M A G
33 The first subway system in America was built in Boston, Massachusetts in 1897
There’re two terms, declaration and
definition. Declaration of an identifier
assigns some name to that identifier
while definition allocated it some
memory. As declaration and definition
are usually done at a same time in C++
so we use a single term.
First of all keep this thing in mind that usually we do not create such blocks as I’ve created in above example (line-4 to line-6). Such
blocks are usually created for loops and if-else conditions but as we’ve not yet learnt about any of these concepts so I’ve simply created
this dummy code, but doing this is not an error. Now coming back to our original discussion, can you guess why compiler will show an
error at line 7? Let’s see why. We created a block at line-4 and declared a variable a in that block. Now a is in memory. But when we
came at line 6, our block is finished here. So everything inside this block is also finished. Now a is no more accessible. It means that life
time of a from line 4 to line 6.
Let’s move towards a more interesting case. As you’ve seen that you can not declare multiple variables or constants with same name.
But have a look at the following code:
1. void main () 2. { 3. int a = 20; 4. { 5. int a = 2; 6. cout<<a; 7. } 8. cout<<a; 9. }
You can see that we’ve declared a twice in main() but still there’s no error. What’s the reason? The reason is the scope of variable a.
Variable a declared at line 3 is accessible anywhere in main() but the other variable a which is declared at line 5 is only accessible in its
own block. It will destroy at line 7 because its life time was from line 4 to line 7. While the life time of first one a is the whole
main().So run and check the output of this program.
Now I’m going to cover the last topic of this episode i.e. storage class specifiers. Storage class specifiers are also keywords which
determine that how a variable will be stored. There’re five storage class specifiers in C++ i.e. auto, extern, register, static and mutable.
auto is a storage class specifier which declares a local variable. By default a variable is declared locally i.e. auto int var; and int
var; are equivalent statements. So usually we do not use auto in our code.
Variables declared with static specifier remains in the memory throughout the execution of program. A variable is usually being
destroyed when it becomes out of scope. But variable declared with static storage class specifiers remains in the memory throughout
the program execution. register specifiers requests the compiler to store the variable at such location from which it can be accessed
with a fast speed. extern specifier only declares a variable, it doesn’t defines variables. mutable is applied only to class object. We’ll
discuss both extern and mutable later because we’ve no need to understand them at this level.
E - M A G
34 Cubic Zirconia is 55% heavier than real diamonds
Author’s notes: I received some emails that the speed of this article is very slow and it will not cover all concepts in one semester.
Yes it is true. But let me make this thing clear that programming concepts are not only for one or two semesters. As a programmer
you’ll need these concepts throughout your life. Therefore it is necessary to make a strong foundation. Many students need to re-
study the fundamental concepts of programming after reaching at an advance level. This is only because they don’t have strong basic
concepts. So do less but do well and remember that slow and steady always wins the race.
If you need any kind of help regarding C++ then feel free to contact me at [email protected]
EExxpplloorree WWiitthh MMee By: Mian Zeshan Farooqi
How to get and set date in C/C++?
There’s a date structures and two functions getdate() and setdate() defined in dos.h.
(You can consider structure as a group of variables). This structure allows you to get and set
the current system date:
struct date{
int da_year; /* current year */
char da_day; /* day of the month */
char da_mon; /* month (1 = Jan) */
};
How to use get or set the date?
#include <iostream.h>
#include <dos.h>
void main ()
{
struct date d;
getdate(&d);
cout<<”Date:\t”<<da_day;
cout<<”Month:\t”<<da_mon;
cout<<”Year:\t”<<da_year;
}
#include <iostream.h>
#include <dos.h>
void main ()
{
struct date d;
d.da_day = 14;
d.da_mon = 8;
d.da_year = 1995;
setdate(&d);
}
E - M A G
35 A cubic yard of air weighs about 2 pounds at sea level.
This monthly segment describes
different functions of C/C++
Get Date Set Date
TTiippss aanndd TTrriicckkss
CChhaannggee DDrriivvee LLeetttteerrss::
Go to Start > Control Panel > Administrative Tools > Computer Management, Disk
Management, then right-click the partition whose name you want to change (click in the
white area just below the word "Volume") and select "change drive letter and paths."
From here you can add, remove or change drive letters and paths to the partition.
RReemmoovviinngg MMuullttiippllee BBoooott SSccrreeeennss::
If you are getting unwanted multiple boot screen, Then Follow these Steps.
1. Right Click on My Computer
2. Select Properties
3. Select Advanced Tab
4. Select Settings In the Start-up & Recovery Section(3rd group)
5. Select the operating system which u want, click OK.
6. Further again press the setting and click on Edit. It will open boot.ini File.
7. Now u can delete those o/s which you don't want to be displayed.
Note: For deleting operating systems from boot.ini file, keep it mind that you can't
delete that o/s which is selected by default there. Before
making any changes make a copy of boot.ini file.
E - M A G
36 The first spacecraft to visit the planet Venus was Mariner 2 in 1962.
SSooffttwwaarree ooff tthhee MMoonntthh
Autodesk® Maya® Complete
Autodesk® Maya® Complete software is a comprehensive suite of 3D tools for
modeling, animation, and rendering within a single, production-proven workflow.
Maya Complete—the choice of award-winning digital artists and animators—has an
intuitive design that makes it a favorite among digital content creation artists and
enthusiasts of all experience levels who develop artwork for film, broadcast, game
development, multimedia (print and web) or design visualization.
Maya Complete 2008 includes toolsets for:
Modeling
Animation
Visual Effects
Rendering
Paint Tools
Toon Shading
PLUS:
Maya API/SDK, Python® and MEL Scripting
Tutorials and Documentation
Just for information: Maya was originally released for the IRIX operating system, and
subsequently ported to the Microsoft Windows, Linux, and Mac OS X operating systems. IRIX
support was discontinued after the release of version 6.5. When Autodesk acquired Alias in
October 2005, they continued Maya development. The latest version, 2009 (10.0), was
released in October 2008.
Download Link: http://www.autodesk.com
E - M A G
37 The word "laser" stands for "Light Amplification by Stimulated Emission by radiation."
Overview by:
Dilawer Hussain
UUsseeffuullll LLiinnkkss
SpeedTest.net
Test the speed of your internet connections from different servers all around
the world. This site recommends you a server to test your connections from but
also allows you to test from any other server around the globe. You can also
compare your results with other people who’re using the same ISP in your
region or with those who tested their connection from this site.
TvChannelsFree.com
This site allows you to different Tv channels online. It has links to more than
4000 tv channels around the world including, news channels, video channels,
entertainment channels, etc. This huge collection is now available to you for
free of cost. Another interesting thing, it allows you to stream same channel
from different servers.
Maps.Google.com
You can find the map of whole world here. Zoom-in and zoom-out the locations.
Explore every city of your country. This service of Google is also free of cost. As
Google earth provides you an enhanced view of the earth. But if you’re at a
place where you don’t have enough time to download and install the Google
earth, then just open this website and do your work.
E - M A G
38 Every second, 630 steel cans are recycled.
TThhee CCoonnssttiittuuttiioonn ooff TThhee IIssllaammiicc RReeppuubblliicc ooff PPaakkiissttaann,, 11997733
PPaarrtt –– II
Article: 1 The Republic and its territories
1. The Republic and its territories. -- (1) Pakistan shall be a Federal Republic to be known as the Islamic Republic of Pakistan,
hereinafter referred to as Pakistan.
1 [(2) The territories of Pakistan shall comprise-]
(a) The Provinces of Baluchistan, the North-West Frontier, the Punjab and Sindh;
(b) The Islamabad Capital Territory, hereinafter referred to as the Federal Capital;
(c) The Federally Administered Tribal Areas; and
(d) Such States and territories as are or may be included in Pakistan, whether by accession or otherwise.
1 [(3****)] deleted.
1 [(3) 2[Majlis-e-Shoora (Parliament)] may by law admit into the Federation new States or areas on such terms and
conditions as it thinks fit.]
Article: 2 Islam to be State religion
2. Islam to be State religion.-Islam shall be the State religion of Pakistan.
Article: 2A The Objectives Resolution to form part of substantive provisions
1[2A. The objectives Resolution to form part of substantive provisions.-The principles and provisions set out in the Objectives
Resolution reproduced in the Annex are hereby made substantive part of the Constitution and shall have effect accordingly.]
1. Item 2 of the Schedule to P.O. No. 14 of 1985 inserted Art. 2A. (w.e.f. March 2, 1985).
E - M A G
39 Bamboo plants can grow up to 36 inches in a day.
Episode # 1
MMAAGG NNEEWWSS
March 26, 2009 – A National Seminar on “Arabic Language in Pakistan, Its Past,
Present and Future” was conducted by Department of Arabic, University of the
Punjab. The seminar was conducted in senate hall. Chief guest was Sahabzada
Noor-ul-Haq Qadri, Federal Minister of Zakat and Usar, Govt. of Pakistan. Profes sor
Dr Mujhahid Kamran, Vice Chancellor, University of the Punjab, Presided the
seminar. There were a huge number of faculty members and students from
different universities of Pakistan, who attended the seminar.
March 29, 2009 – First tape ball tournament started at PUCIT. There’re total 16
teams. Tournament would be go on knock-out basis. The event is organized by Mr
Fareed-ul-Hassan Baig, Faculty member of PUCIT. Matches are being played at
ground of Khalid-bin-Waleed Hostel. Final match would be played on Monday, April
6, 2009.
March 30, 2009 – An Islamic Quiz and speech competition was arranged by E vent
Management Society, PUCIT. For quiz competion there were 9 teams. Each team
consist of 3 members. Topics were Seerat-e-Tayyaba, Sahaba and Ghazwat. All
matches were played on knock out bases. Quiz competition starts at 11:00 am. Mr
Aasim Rasul and Ms Qudsia Hamid were judges.
E - M A G E - M A G
40 In 1903 Mary Anderson invented the windshield wipers
Honourable guests during seminar
Teams during competition
Players during match
PPiiccttuurreess ooff PPaakkiissttaann
E - M A G
41 At lift off, US space shuttles weight about 4.5 million pounds.
Source: Geo Tv, BBC, CNN, Yahoo News, Reuters, AP
A new monthly segment under MAG NEWS
Before and After Long March
E - M A G
42 The first jet engine was invented by Frank Whittleof of England in 1930
Source: Geo Tv, BBC, CNN, Yahoo News, Reuters, AP
Attack on Police Academy Manawan, Lahore
NNOOTTIICCEESS
If you are a good writer or a good poet and want to write for E-MAG then you
can send us your stuff at [email protected] If you like to share some
article or other stuff from your collection then you must mention the name of
original writer or poet.
Send us your feed backs at [email protected] or if you want to
communicate with any of the writers then send us your message at same
address and we’ll forward your message to the respective person.
You can download E-MAG from http://emagportal.com or you can also
subscribe to our mailing list to receive a copy of E-MAG every month.
Some supporting files like WinRAR, Adobe Acrobat Reader, and other
supporting files which are discussed in articles are available at
http://emagportal.com
Website: http://emagportal.com
Email: [email protected]
E - M A G
Copper is the second most used metal in the world
This is the last page of E-MAG and has been left blank intentionally.
E-MAG is designed by: Mian Zeshan Farooqi