Saturday, March 19, 2011

Re: ::::|| VU ||:::: LearnC_lecture02

Exercise:

 

Q1.which of the following are invalid variable names and why?

 

Interestingpaid

(Valid variable name)

 

si-int   

(Invalid variable name because no special symbol is allowed)

 

AVERAGE

(Valid variable name)

 

~percent

(Invalid variable name because no special symbol is allowed)

 

123

(Invalid variable name because the numeric characters are not allowed and only alphabetic are allowed)

 

temp of rom

(Invalid variable name because blank spaces are not allowed between variable names)

 

to play

(Invalid variable name because blank spaces are not allowed between variable names)

 

Name.

(Invalid variable name because (.) is special symbol and no special symbol is allowed)

 

float.

(Invalid variable name because of two reasons ,firstly float is c reserved word so it can not be use as a valid variable name and secondly (.) is special symbol and no special symbol is allowed)

 

 

 

Q2.Findout the errors if any

 

int value=52.23;

52.23 is a real or floating point constant value but not integer constant value so we can say it is wrong statement.

 

float name='A';

'A' is character constant value but not floating point constant value so we can say it is wrong statement.

 

char data=120;

in character constant value only one character can be used

so we can say it is also a wrong statement.



On Fri, Mar 18, 2011 at 7:12 PM, MOAAZ SIDDIQ <moaaz.pk@gmail.com> wrote:
saeeda sister mera MCS chal raha he..............

On Fri, Mar 18, 2011 at 4:16 PM, mc100402098 Syeda Saeeda Batllo <mc100402098@vu.edu.pk> wrote:
Moaaz bhai aap ka study programm kon sa ha

On Fri, Mar 18, 2011 at 4:14 PM, mc100402098 Syeda Saeeda Batllo <mc100402098@vu.edu.pk> wrote:
thanks for healping in our c++

On Fri, Mar 18, 2011 at 3:57 PM, MOAAZ SIDDIQ <moaaz.pk@gmail.com> wrote:
JAZAK ALLAH KHER BROTHER

abhi tu 4pm ko light off ho jai gi

me rat ko ise read karon ga phir agar koi question hoa tu aap se pooch lon ga..........


On Fri, Mar 18, 2011 at 3:50 PM, And-or-Logic <bc100400662asad@gmail.com> wrote:
ok nop


On Fri, Mar 18, 2011 at 3:10 PM, CoooL <asad.coool786@gmail.com> wrote:
nice brother main abi aik kam se ja raha hoon aa kar iss ko dekhta hoon.


On Fri, Mar 18, 2011 at 9:53 AM, And-or-Logic <bc100400662asad@gmail.com> wrote:
Topic
variable
Rules for constructing variables.
Tyepe Decleration
Tips 
Exercise.
******************
yeh Lecture aor any waly 2 lectures k bad mai koshish karo ga k hum real world problems ki tarf 
apny discussion shuru kary aor real time programs likhney shuru kar dey,lekin is k ley zarori hai k hum sub
k basic concepts clr ho,tak k agy chal kar hum ko kissi qism ki tension na hoo
******************
To aye discussion shuru kartey hian 

*variable and why use them
programming k doran aksar hi aesa hota hai k hum ko different type k data ko mange          karna parta hai. baz auqat 
programing mai calcualtions k ley hum ko kuch numeric values ki zarrorat hoti hai
iss tarha k data ko store karwaney k ley programing languages mai variable constructing ka aik powerfull feature hota hia
jo k har language mai paya jata hai
computer memory jo k blocks per mushtamil hoti hain in blocks ko hum variable ki madad sey access karty hian. 
  
yeh to app ko pta hi ho ga k hmara koi bi program jab chal raha hota hai to wo ram per load howa hota hai. iss ley jo bi data us progaram mai use ho raha 
hota hai wo in memory blocks per in varibals ki shakal mai read ya write ho raha hota hi.yani dosry lafzo mai yun keh ley k variable mermy locations ko hi kehtey hain.
in variable mai integer,real aor character type ka data store ho sakta hai.
**********************
*Rules for constructing variables.
1.variable can of length equal to 40 alphabets.
2.The first character in variable name must be an alphabet.
3No commas aor blank sapces are allowed between variable name.
3.No special symbol other than (_) can be used 
4.c reserve words cannot be use as  varibale name.

Notes:every C variable must have atleast 
Name
Type
Size
value

For example
*~temp; is wrong because variable should be start from an alphabet or _

Asad Ali; is wrong because space not allowed in  a varible name

waseem.akram; is wrong because . a special symbol in this case a period  that is not allowed.
*******************************

*Tyepe Decleration
jesa k hum ney previous lecture mai dekha k hamarey pass 3 types ki values hoti hian whole value,floating point value and character type value.
ab question yeh peda hota hai k C k compiler ko kiss tarh pta chalta hai k jo variable hum ney create kiya hai iss main data kiss type ka store
ho ga.
to in teno tyeps mai imtiyaz karney k ley c aik special instrution provide karti hia jiss ko boley hain. "Type declatrion instruction."
yeh instruction compiler ko yeh btati hai k jo variable user ney create ky hai iss ka name kiya ho ga. in ki type kiya ho gi.
is ki koi initial value hai k nahi hai.aor finaly yeh k kitney size ka varible ho ga. 
to aye iss ko aik example ki maddad sey clr karty hain.

For example

1.int day=1;
iss statement mai "int" aik C ka keyworkd hai jo yeh btata hai k iss variable ka size kitna hoga ao type kiya ho gi.mazeed yeh k iss instruction sey
yeh bi pta chalta hai k variable ki value aor name kiya hai.
iss case mai 
Type=integer type hai. 
size=2 byte jo k int ka builtn  size hai 
value= 1 hai.
name= day hai
2.float PI=3.1415;
Type=floating point varibale
size=4 byte but can confirm alos.
Name=PI
value=3.1415

3.char Blood_group='B';
Type=character
Size=1 byte
value=B
name=Blood_group
********************************
 NOTE:
 dear student abi app sirf inta yad rakhy k basicaly  3 types of varibes hain jo yeh      hain
int 
float
character


Tips:
jab bi hum koi varible create karty hain to iss varible ko foran initialize karna chahy q k yeh variable memeory ki jiss locatin ko
point kar raha hai wha mumkin hai k koi data pehly sey majood hun lehaza apney progrm mai use karney k ley zaroori hai k iss ko pehly zero sey initiaze kar diya jaey
For example 
int sum=0;
variable ka name user friendly rakhy tak  k agr yeh code review kiya jaey to dosry ko bi samj aajy k varible kiss cheez k ley create kiya giya ho ga.
 ***************************** 


Exercise:

Q1.which of the following are invalid variable names and why?
Interestingpaid
si-int
AVERAGE
~percent
123
temp of rom
to play
Name.
float.

Q2.Findout the errors if any

int value=52.23;
float name='A';
char data=120;
******************

--

Take your soul out of the way from cheristanity 
Asad Ali

BSc (Semester-02) 

City.Lahore


--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en



--
For study materials, past papers and assignments,
 Join us on
 www.VuScool.com
 
 
Google Groups
CoooL Virtual University Students
Visit this group

                 <<<<<<< pAncHi >>>>>>>

             

--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en



--

Take your soul out of the way from cheristanity 
Asad Ali

BSc (Semester-02) 

City.Lahore


--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en



--


تو غنی  از ھر دو عالم من فقیر
روزِ محشر عذر ھائے من پذیر
گر (ور) حسابم را تو بینی نا گُزیر
از  نگاہِ   مصطفیٰ   پنہاں   بگیر

اے اللہ میں تیرا منگتا ہوں، تو دو عالم کو عطا کرنے والا ہے۔ روزِ محشر میرا عذر قبول فرمانا اگر میرے نامہ اعمال کا حساب نا گزیر بھی ہے تو پھر اے میرے مولیٰ اسے میرے آقا محمد مصطفیٰ صلی اللہ علیہ وسلم کی نگاہوں سے پوشیدہ رکھنا۔



--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en


--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en



--


تو غنی  از ھر دو عالم من فقیر
روزِ محشر عذر ھائے من پذیر
گر (ور) حسابم را تو بینی نا گُزیر
از  نگاہِ   مصطفیٰ   پنہاں   بگیر

اے اللہ میں تیرا منگتا ہوں، تو دو عالم کو عطا کرنے والا ہے۔ روزِ محشر میرا عذر قبول فرمانا اگر میرے نامہ اعمال کا حساب نا گزیر بھی ہے تو پھر اے میرے مولیٰ اسے میرے آقا محمد مصطفیٰ صلی اللہ علیہ وسلم کی نگاہوں سے پوشیدہ رکھنا۔






--


تو غنی  از ھر دو عالم من فقیر
روزِ محشر عذر ھائے من پذیر
گر (ور) حسابم را تو بینی نا گُزیر
از  نگاہِ   مصطفیٰ   پنہاں   بگیر

اے اللہ میں تیرا منگتا ہوں، تو دو عالم کو عطا کرنے والا ہے۔ روزِ محشر میرا عذر قبول فرمانا اگر میرے نامہ اعمال کا حساب نا گزیر بھی ہے تو پھر اے میرے مولیٰ اسے میرے آقا محمد مصطفیٰ صلی اللہ علیہ وسلم کی نگاہوں سے پوشیدہ رکھنا۔



--
For study materials, past papers and assignments,
Join VU School at www.VusCool.com
and www.VUGuys.com
CoooL Virtual University Students Google Group.
To post to this group, send email to coool_vu_students@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/coool_vu_students?hl=en

No comments:

Post a Comment