We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Graded Discussion Board (GDB) of CS201 will open on Thursday August 07, 2014 and close on Friday August 08, 2014. GDB will remain open for two days, you are required to post your comments within due date.

GDB topic: 

Is it more expensive to use too many static variables instead of ordinary variables?  If yes, then how?

Your answer must be concise and not be more than 200 words.


Note: Keep you comment brief and to the point, GDB will not be accepted through email in any case.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 3303

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

kia yee solution thik h?plssssss tell

it would be more expensive to use static variables instead ordinary variables due to the fact that automatic variables are created and destroyed when they go in and out of scope (so memory is freed after the program is out of the Block in which a variable is declared). Whereas static variables are stored until the program terminates – meaning they remain allocated even if you don’t need them in your program after a certain point; which is “wasted” memory.
Static variable:
1)Memory allocated before creation of object.
2)static variables are class variables and the values remains
same fr the whole class and its value is same for all classes in a program.
3) There is only one copy of static variable and even
when the class is instantiated, the value remains the same.
4)Static variables value is automatically show(there is no need to create an object.

• rdinal Variables
• An ordinal variable is a categorical variable for which the possible values are ordered. Ordinal variables can be considered “in between” categorical and quantitative variables.

Example: Educational level might be categorized as
1: Elementary school education
2: High school graduate
3: Some college
4: College graduate
5: Graduate degree
• • In this example (and for many ordinal variables), the quantitative differences between the categories are uneven, even though the differences between the labels are the same. (e.g., the difference between 1 and 2 is four years, whereas the difference between 2 and 3 could be anything from part of a year to several years)
• Thus it does not make sense to take a mean of the values.
• Common mistake: Treating ordinal variables like quantitative variables without thinking about whether this is appropriate in the particular situation at hand.
• For example, the “floor effect” can produce the appearance of interaction when using Least Squares Regression, when no interaction is present.1

Agresti (2010)1 discusses methods that are appropriate for ordinal data.
Permutation tests2 (also known as randomization tests) can also be used on ordinal data

kia yeee solution thik h

gyz frnds bro and sis

solution plz

Book > CS201 > Lecture 24 > 3rd Paragraph

plz solved gdb

 cs201 GDB 2014

IDEA SOLUTION

It's not a problem. However, it is generally accepted good design practice to limit the scope of every variable so that it's as wide as it needs to be - but no wider ;-) 

This means that: 
- you don't use a method local variable as the controlled variable of a for loop, if you can declare the controlled variable in the for loop heading. 
- you don't use a class global variable (field) inside a method if you can instead use a local variable declared inside the method. 
- you don't declare a field public if it can be protected, nor protected if it can be private. 
- you don't declare a field static if it can be non-static. 
- class level "final" values should be declared static

There's no difference in performance between accessing static and non-static variables.
Moreover statics reduce the inter-dependencies on the other parts of the code. They can act as perfect state holders. Adding to this I find that statics are widely implemented in some languages like Smalltalk and scale So why is this oppression for statics prevalent among programmers (especially in the world of Java)?
Static variables represent global state. That's hard to reason about and hard to test: if I create a new instance of an object, I can reason about its new state within tests. If I use code which is using static variables, it could be in any state - and anything could be modifying it.
I could go on for quite a while, but the bigger concept to think about is that the tighter the scope of something, the easier it is to reason about. We're good at thinking about small things, but it's hard to reason about the state of a million line system if there's no modularity. This applies to all sorts of things, by the way - not just static variables.

it would be more expensive to use static variables instead ordinary variables due to the fact that automatic variables are created and destroyed when they go in and out of scope (so memory is freed after the program is out of the Block in which a variable is declared). Whereas static variables are stored until the program terminates – meaning they remain allocated even if you don’t need them in your program after a certain point; which is “wasted” memory.

static variables are expensive :-
1. it remains in memory ,the entire run time of the program.
2. static variables are not thread safe.
3. it violates the principle of information hiding(encapsulation)
4. it is difficult to test the code with static variables.

kia sbny gdb solve kr li?

The main thing which i observed during programing Usually using static Vs ordinary variable is Re-usability issue of that variable .. Means once i have declared a static variable somewhere on the page and after 2-3 days when i code back that page i usually forget that Static variable and i use the same name for other variable which causes wrong results in my ultimate solution.. 2nd thing is off-course is memory usage of static variable. 3rd thing is visibility factor of static variable.. Student can google for memory usage and visibility of static variable and they will get much information about it..

Ordinal Variables

An ordinal variable is a categorical variable for which the possible values are ordered. Ordinal variables can be considered “in between” categorical and quantitative variables.

Example: Educational level might be categorized as
    1: Elementary school education
    2: High school graduate
    3: Some college
    4: College graduate
    5: Graduate degree

•    In this example (and for many ordinal variables), the quantitative differences between the categories are uneven, even though the differences between the labels are the same. (e.g., the difference between 1 and 2 is four years, whereas the difference between 2 and 3 could be anything from part of a year to several years)
•    Thus it does not make sense to take a mean of the values
•    Common mistake: Treating ordinal variables like quantitative variables without thinking about whether this is appropriate in the particular situation at hand.
•    For example, the “floor effect” can produce the appearance of interaction when using Least Squares Regression, when no interaction is present.1


Agresti (2010)1 discusses  methods that are appropriate for ordinal data.
Permutation tests2 (also known as randomization tests) can also be used on ordinal data.

Static variable:
1)Memory allocated before creation of object.
2)static variables are class variables and the values remains 
same fr the whole class and its value is same for all classes in a program.
3) There is only one copy of static variable and even 
when the class is instantiated, the value remains the same.
4)Static variables value is automatically show(there is no need to create an object.

i think amna ch ur solution is right.

RSS

Latest Activity

+ ! ❤️ ░S░I░N░G░E░R liked ٥ دن's discussion Gunahon ki gehrai
7 seconds ago
+ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! replied to + "αяsαℓ " Ќąƶµяɨ •"'s discussion Happy Marriage to "Zee" & " Nomi weds Noor"....!
9 minutes ago
Qaisar nadeem replied to + M.Tariq Malik's discussion ENG201 Business and Technical English Writing Assignment No 01 Fall 2019 Solution & Discussion in the group ENG201 Business and Technical English Writing
10 minutes ago
Profile IconQaisar nadeem and Isha Chuhdary joined + M.Tariq Malik's group
10 minutes ago
+ ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! posted a discussion
21 minutes ago
+ !! "AS" !! replied to + !! "AS" !!'s discussion Jis Tarah ..
36 minutes ago
+ !! "AS" !! replied to + !! "AS" !!'s discussion Baat Karna ...
37 minutes ago
+ !! "AS" !! replied to + !! "AS" !!'s discussion Ghalti...
38 minutes ago
+ !! "AS" !! replied to + !! "AS" !!'s discussion Yaha Har Cheez ..
38 minutes ago
+ !! "AS" !! replied to + !! "AS" !!'s discussion Alfaaz Ki Nisbat..
39 minutes ago
Profile IconSafdar Mehmood, Shayaan, Hafiz muhammad sufyan and 28 more joined Virtual University of Pakistan
40 minutes ago
+ ! ! ! ! ! ! ReBeL replied to ٥ دن's discussion Gunahon ki gehrai
1 hour ago
MUHAMMAD USMAN replied to MIT's discussion cs604 Quize#1 fall semester 2019 in the group CS604 Operating Systems
1 hour ago
+ ! ! ! ! ! ! ReBeL replied to +¢αяєℓєѕѕ gιяℓ's discussion Iss tasvir ko Unwan Dein :-P
1 hour ago
مخلص posted a discussion
1 hour ago
ambreen fatima and Muhammad Hamza Mehmood are now friends
1 hour ago
MIT added a discussion to the group CS604 Operating Systems
1 hour ago
sardarni liked + M.Tariq Malik's discussion MCM531 Community Journalism Assignment No 01 Fall 2019 Solution & Discussion Due Date: 22-11-2019
2 hours ago
sardarni joined + M.Tariq Malik's group
2 hours ago
blackeagle replied to + M.Tariq Malik's discussion EDU402 Curriculum Development Assignment No 01 Fall 2019 Solution & Discussion in the group EDU402 Curriculum Development
3 hours ago

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service