Ad Code

cs101 short notes






Cs101(Introduction to Computer)

“Long question and answer”
1. Write a note on other virus like programs (10)
Answer:
Other Virus-Like Programs
•           There are other computer programs that are similar to viruses in some ways but different in some others.
•           Three types:
–          Trojan horses
–          Logic- or time-bombs
–          Worms

Trojan Horses
•           Unlike viruses, they are stand-alone programs
•           They look like what they are not
•           They appear to be something interesting and harmless (e.g. a game) but when they are executed, destruction results.

Logic- or Time-Bombs
•           It executes its payload when a predetermined event occurs
•           Example events:
•           A particular word or phrase is typed
–          A particular date or time is reached

Worms
•           Harmless in the sense that they only make copies of themselves on the infected computer
•           Harmful in the sense that it can use up available computer resources (i.e. memory, storage, processing), making it slow or even completely useless

Designing, writing, or propagating malicious code or participating in any of the fore-mentioned activities can result in criminal prosecution, which in turn, may lead to jail terms and fines!

2. What is holographic storage? (2 marks)
Answer:
Holographic storage:
Holographic data storage is a potential replacement technology in the area of high-capacity data storage currently dominated by magnetic and conventional optical data storage.

3. What is semantic web and how is it different from normal web? (2 marks)
Answer:
Symantec Web:
The Semantic Web is the future generation in WWW technology.  It envisages information from diverse sources being easily combined and used in profoundly different and more powerful ways.
4. Write the types of computer networks? (2 marks)
Answer:
Types of Computer Networks according to the network access policy
•           Private
•           Public

5. What are structured vector graphics? (3 marks)
Answer:
Structured Vector Graphics
•           New format; may become more popular than Flash
•           Plug-in required
•           Text-file storage; search engine friendly
6. What is in line java script event handling? (5 marks)
Answer:
In-Line JavaScript Event Handling:
Event handlers are placed in the BODY portion of a Web page as attributes of HTML
Tags
The event handler attribute consists of 3 parts:
The identifier of the event handler
The equal sign
A string consisting of JavaScript statements enclosed in double or single quotes
Multiple JavaScript statements (separated by semicolons) can be placed in that string, but
All have to fit in a single line; no new line characters are allowed in that string
Due to this limitation, sophisticated event handling is not possible with in-line event
Handling


Ppaer#2 CS101 (Solved)

1. Define the term 3D Rendering? (2 marks)
Answer:
3D Rendering:
The process of converting information about 3D objects into a bit map that can be displayed on a 2D computer display
Computationally, very expensive!
Steps:
Draw the wire-frame (skeleton, made with thin lines)
Fill with colors, textures, patterns
Add lighting effects (reflections shadows)
2. What is an intelligent system? (2 marks)
Answer:
Intelligent system:
SW programs or SW/HW systems designed to perform complex tasks employing strategies that mimic some aspect of human thought.
3. What is a compiler? Write its one benefit over interpreter? (5 marks)          
Answer:
Compiler:
Compiler translates the program written in a HLL in one go. The translated code is then used by the up whenever the program needs to be run.   
 To run a program you've written, e.g. in JAVA, it must first be translated into machine code so the computer can read it. This is what compilers and interpreters do. 
However, compilers convert the code all at once, save it, and then run it; whereas interpreters translate the code one line at a time, as it is run. 
Interpreters tend to result in faster translating of code so they are used mostly for debugging. This is because if you used a compiler, you'd have to re-compile your entire project every time you changed one little thing. 
4. Who is a computing professional? (3 marks)
Answer:
Computing professional
• Computer scientists, software engineers, computer engineers, and some of the
Telecom engineers are generally classified as computing professionals
5. What are Trojan Horses? (3 marks)
Answer:
Trojan Horses
•           Unlike viruses, they are stand-alone programs
•           The look like what they are not
•           They appear to be something interesting and harmless (e.g. a game) but when they are executed, destruction results
6. What is ICMP? (3 marks)
Answer:
ICMP stands for Internet Control Message Protocol.
7. What is ARPANET and who developed it? (5 marks)
Answer:
The Advanced Research Projects Agency Network (ARPANET), was the world's first operational packet switching network and the core network of a set that came to compose the global Internet. The network was created by a small research team at the Massachusetts Institute of Technology and the Defense Advanced Research Projects Agency (DARPA) of the United States Department of Defense. The packet switching of the ARPANET was based on designs by Lawrence Roberts of the Lincoln Laboratory.
8. Write down the advantages of Natural Language Processing. (5 marks)
Answer:
If your question is more specifically about prolog vs the more commonly seen OO languages I would argue that you're really comparing apples to oranges - the "advantage" (such as it is) is just a different way of thinking about the world, and sometimes changing the way you ask a question provides a better tool for solving a problem.

CS101 Final Paper#3 (Solved)

1. What is meant by universal access of internet services?    (2 marks)
Answer:
Universal access of internet services means same functionality to every one.
2. How can we include images in a web page using HTML and Java script? 
(3 marks)
Answer:
Images in HTML
It is quite straight forward to include gif and jpg images in an HTML webpage using the tag.
Format:    text

Images in Java script
Images in java script can be manipulated in many ways using the built in object image.
Properties: name,border,complete,height,width,hspace,bspace,lowsrc,src
Methods: none
Event handler: on Abort, on error, on load etc.
3. Define Primary key and Queries? (3 marks)
Answer:
Primary Key
Primary key is a field that uniquely identifies each record stored in a table.

Queries
Queries are used to view, change, and analyze data. They can be used to combine data from different table and extract the exact data that is desired.
4. What is a compound condition? Give example. (3 marks)
Answer:
Compound condition is putting multiple statements at places where java script expects only one for those situations. This is done simply by enclosing any numbers of statements within curly braces, for example
 {If ((day == "Sunday") // (day == "Saturday"))
(Bhola = "cool";
Mood = "great";
Clothing = "casual";}
5. Differentiate between For and While loop by writing the syntax of both loops.
(5 marks)
Answer:
The only difference between FOR loop and WHILE loop is the syntax for defining them. There is no performance difference at all.

Syntax of both loops
For( x = 99 ; x < 6000 : x = x + 1)
{ document . write (x) :}

While (tanks full == false )
{ tank = tank + bucket : }
Document. write ("tank is full now");
6. Can a human doctor be replaced by an Expert System? Give reasons to support your answer. (5 marks)
Answer:
Yes, a human doctor can be replaced by an expert system because systems that, in some limited sense, can replace an expert. Expert system can act as intelligent assistant to human experts or serve as a resource to people who may not have access to expert. And also the purpose of all application (expert system) is not to replace our human experts but to make their knowledge and experience more widely available.
7. How education is changed because of advancements in the field of computing? (10 marks)
Answer:
Distance learning has received a boost due to the low price of internet and the availability of web based interactive content.
Physical location is less of a hindrance now. 
It has also become possible for students to interact with other students as well as teachers situated along distance from them.
Students enrolled in distance education programs have more control over what they want to learn, how and when they want to learn.
The lack of face to face interaction and immediate questions and answers reduce the amount of knowledge that can be transferred from the teacher to the students.
Computer based distance education may be the only source of high quality education for many, especially those in remote locations.
Distance education is the best mode of education and convenient, which has become more effective with the augmentation of computer based learning. 
Distance learning is also world most important education system by which we can study at home and manage or get our study materials online.
Also Distance learning allows us to refer online quizzes, assignments timely. 
 By this field of computing one can get billions of knowledge by searching through internet. 

CS101 Paper#4 (solved)

1. What does NIC stand for? (1 mark)
Answer:
NIC stands for National Identity Card.
2. Name any  software which can be used to make a presentation. (1 mark)
Answer:
Presentation Development SW is used to make a presentation.
3. How does a JavaScript array are heterogeneous? (2 marks)
Answer:
JavaScript Arrays are Heterogeneous
Unlike many other popular languages, a JavaScript Array can hold elements of multiple
Data types, simultaneously
a = new Array (9);
b = new Array (13);
b [ 0 ] = 23.7 ;
b [1 ] = “Bhola Continental Hotel” ;
Introduction to Computing –CS101 VU
© Copyright Virtual University of Pakistan
181
b [ 2 ] = a ;

4. What is the database? (2 marks)
Answer:
Database:
A collection of data organized in such a fashion that the computer can quickly search for
a desired data item
All data items in it are generally related to each other and share a single domain
They allow for easy manipulation of the data
They are designed for easy modification & reorganization of the information they
contain
They generally consist of a collection of interrelated computer files.
5. Differentiate between LAN and WAN with one example of each. (3 marks)
Answer:

LAN
WAN

A network of computers located in the same building or a handful of nearby buildings.
A network in which computers are separated by great distances, typically across cities or
even continents
May consist of several interconnected LANs

Example: Computer network at your PVC
Example: The network connecting the ATM of a bank located in various cities


6. What are Trojan Horses? (3 marks)
Answer:
Trojan Horses
•           Unlike viruses, they are stand-alone programs
•           The look like what they are not
•           They appear to be something interesting and harmless (e.g. a game) but when they are executed, destruction results

7. What do you mean by FTP or File Transfer Protocol? (3 marks)
Answer:
File Transfer Protocol (FTP), a standard Internet protocol, is the simplest way to exchange files between computers on the Internet. Like the Hypertext Transfer Protocol (HTTP), which transfers displayable Web pages and related files, and the Simple Mail Transfer Protocol (SMTP), which transfers e-mail, FTP is an application protocol that uses the Internet's TCP/IP protocols. FTP is commonly used to transfer Web page files from their creator to the computer that acts as their server for everyone on the Internet. It's also commonly used to download programs and other files to your computer from other servers.
8. What are the responsibilities and profile of a Team Lead? (5 marks)
Answer:
Team Lead
• Responsibilities:
– Planning and tracking of the project
– Detailed design
– Professional development of team members
– In case of small teams, development activities
• Profile:
– 5+ years of development experience
– Excellent interpersonal skills
– Good planning skills
– Good design skills

9. Is tabular data storage better than flat file data storage? 
Answer:
Yes tabular data storage is better than flat file data storage 
  

CS101 Paper#5 (Solved)

1. What are Local or Function-level Variables? (1 MARK)
Answer:
In computer science, a local variable is a variable that is given local scope. Such a variable is accessible only from the function or block in which it is declared. In programming languages with only two levels of visibility, local variables are contrasted with global variables, on the other hand, many ALGOL-derived languages allow any number of levels of nested functions with private variables, functions, constants and types hidden within them.
2. What is a function? Give one example. (2 marks)
Answer:
User Define Functions are used to define its own T-Sql 
Function which can have 0 or more input parameters and 
Returns a single scalar data value type or table data type.
We have three type of UDF:-

1. Scalar user defined function
2. Inline table valued Function
3. Multiple table valued function

3.  What is the Data Normalization? Also define its goal. (2 marks)
Answer:
Data normalization is to sort out complex data into simple form. It uses to simplify the complex information to make it more user-friendly.

4. What is the preferred organizational structure for the organization? (3 marks)
Answer:
Preferred Organizational Structure for organization is hierarchal. Where there is different departments interconnected with each other and are been divided according to the functions they perform.

5. Differentiate Local and Global Variables. (3 marks)
Answer:
Local variables are the variables have limited scope while global have bigger scope
Local variables are not accessed by others while global is accessible to every one
Local variable used by single user while global variable can be used by different users at time from all around.

6. Elaborate Vector or Object oriented graphics with at least one example. (3 marks)
Answer:
             Object Oriented Graphics are the graphics which are generally oriented towards the objects and have good quality to portray objects these graphics are object oriented and use in animation, games and movies as well. 

7. How DoS attack is a cyber crime? For what cyber crime can be used? (5 marks)
Answer:
DoS stands for Decline of Service and it is a cyber crime as it jams and in some cases shut down the targeted computer by sending too much unnecessary data packets to it which ultimately exceeds the normal processing eventually results the computer or server to stuck and unable to provide services to others. It can be used to destroy the fame and diminishing of no of users requesting information and services from that particular server or computer.

CS101 Paper#6 (Solved)

1. What are the elements of website design? Any one (1 mark)
Answer:
Elements of webdesign: There are in 3 elements of web design and below are there names:
Navigation scheme
Overall look and feel
Layout of information

2. What kind of information can be stored in a database ?(2 marks)
Answer:
Numbers, Booleans, text
Sounds
Images
Video
3. Why hub is used in networks? (2 marks)
Answer:
HUB: Hub is networking component which can be used to connect the networks and it can also be used to extend the size of networks. 
Simply it can be explained as a common connection point for devices in a network. It contains multiple ports like 8port, 16 port , 23 port hubs

4. Write names of the DoS attack’s phases? (2 marks)
Answer:
DoS (Denail of service): DoS attach has in total 3 phases and below they are listed: 
Search
Arm
Attack

5. What do you mean by FTP or File Transfer Protocol? (3 marks)
Answer:
FTP: File transfer protocol was first introduced in 1973; it standardized the transfer of files between computers on a TCP/IP network (e.g internet).
It can download or upload files to a remote computer using the FTP protocol Operations performed using FTP:

List, change, create folders on a remote computer
Upload and download files

Usage: Transferring Web content from the developer’s PC to the Web server

6. How many types of errors can be found during a program development? List them. (3 marks)
Answer:
Syntax errors
Semantic errors
Run-time errors
7. Why the number of temporary workers is on the rise? Discuss main reasons? (5 marks)
Answer:
   Temporary workers:
Temporary workers are those workers which a company can hire to perform a certain task with in a defined time period.
Temporary workers are mostly consultants which move organization to organization to perform assigned workers.

Reasons:
Now-a-days; whole world is suffering from financial crisis, most of the companies have frozen there hiring, just in case they need a resource they are looking for a temporary worker for a specified time span to perform a specialized task and they just pay him for that period of time.
Temporary workers are mostly consultants which have expertise in a certain field and they are considered specialists in that field.
Employer doesn’t need to train the temporary worker.
8. Define network organization? What are important features of network organization? (4+6)
Answer:
Network Organization : 
Network organization is an interfirm organization that is characterized by organic or informal social systems. A company or group of companies that has a minimum of formal structures and relies instead on the formation and dissolution of teams to meet specific objectives..

Features of Network Organization:
The organizations are learning that business can be done in a more effective manner if emphasis is placed upon cooperation, shared responsibility and networking:
Within the organization
And also with their customers and suppliers
Changes according to the demand of the times
Works effectively to meet the business goals of the organization
Everyone has a feeling that he/she is playing a major role in the organization which eventually gives a feel of ownership and because of that employee can put his best effort to accomplish a task.

CS101 Paper#7 (Solved)


1. What is bandwidth? (1 mark)
Answer:
Bandwidth  is a capacity of communication channel of carrying data.
 
2. What is “My Personal Agent”? (1 mark)
Answer:
A computer programe that work automatically and have voice interface
    
3. For what purposes FTP is used in networks ? (2 marks)
Answer:
To download or upload files / data to a remote computer
    
4. How can you define a readable program? (2 marks)
Answer:
A program that is easy to read & understand also easy to maintain and enhance.
    
5. What is the preferred organizational structure for the organization? (2 marks)
Answer:
The Network Organization: It is becoming the preferred organizational structure.
6.  can you define a consistent web design? Why is it needed? (3 marks)
Answer:
A consistent web design is Easy understandable, not with heavy graphics, easy navigation. It is needed because most of the website views leave the site because of poor navigation and not easy to understand, text and design is not clear etc.
7. Elaborate Vector or Object oriented graphics with atleast one example. (3 marks)
Answer:
Vector treats everything that is drawn as object, they are resolution in dependent and relatively small file size. For example swg, svg, wmf.

8. What are the advantages of multimedia presentations? Write any five. (5 marks)
Answer:
Multimedia presentation is a great tool for effective communication:
Advantages:
Easy to make last minute change
More attractive
Can include animation, videos etc.
Better presentation easy to understandable for participants comparing to manual presentation.
Undo feature
9. Can a human doctor be replaced by an Expert System? Give reasons to support your answer. (5 marks)
Answer:
Expert System is a computer system which simulates the knowledge and expertise of a human expert. Yes, a human doctor can be replaced by an Expert System. Following are the reasons to support my answer:
A large database of knowledge can be added to and  kept up to date, it can store more knowledge than a person.
The Expert System cannot FORGET or get facts wrong.
It survives forever. There is no loss of knowledge as there is when a doctor retires.
The Expert System can access specialist knowledge that a doctor may not have.
10. Explain the following issues of Data Management? (3+4+3)
Answer:
Data entry
Data updates
Data security

DATA ENTRY:
There is new data entered  every day.
New customers are added every day.
Some of the data entry requires the manual entry into computer system
New data entry needs to be entered correctly

DATA UPDATES:
Old titles must be removed regularly
Data changes every time
Prices change
Transportation / shipping cost changes
Customer personal data changes
Schemes changing, new offers
Every new entry needs to be entered correctly

DATA SECURITY:
All data in the system is very critical to its operation, the security of the customer’s personal data is most important. Most of the hackers are always trying for that type of information specially Credit Card Numbers.
This problem can be managed by using proper security arrangements and mechanisms that provides access to only authorized entities. System Security can be improved through, encryption, firewalls and updated Antivirus Softwares

11. Write a note on the followings (10 marks)

Image Preloading process
Animated Gifs
Answer:

IMAGE PRELOADING PROCESS:

The primary use of image preloading process is to download the image into the cache before it is actually needed to display.

PROCESS:
An example of the image object is shaped using the NEW keyword
The src property of this instance is set equal to the filename of the image to be pre-loaded
This step starts the down-loading of the image into the cache without actually displaying
When a pre-loaded image is required to be displayed, the src property of the displayed image is set to the src property of pre fetched image


ANIMATE GIFS:

We can save 16 gif images of the previous example in a single file in the form of an animated gif, and then used it in a regular tag to display a moving image. However, JavaScript provide better control over the sequencing and the gap between the individual images.

CS101 Paper#8 (Solved)

1. SMTP stands for what? (1 mark)
Answer:
SMTP, Simple Mail Transfer Protocol (internet email).
2. What are the types of computer network according to the distance between nodes?
(5 mark)
Answer:
Types of Computer Networks according to the distance between nodes
LAN: Local Area Network)
WAN: Wide Area Network)

LAN
A network of computers located in the same building or a handful of nearby buildings
Examples:
–Computer network at your PVC
–Computer network of a University campus

WAN
A network in which computers are separated by great distances, typically across cities or even continents
May consist of several interconnected LANs
Example:
–The network connecting the ATM of a bank located in various cities
–A network connecting the local and oversea offices of a SW house
–Internet
3. What is the difference between Internet and Intranet? (2 marks)
Answer:
There's one major distinction between an intranet and the Internet: The Internet is an open, public space, while an intranet is designed to be a private space. An intranet may be accessible from the Internet, but as a rule it's protected by a password and accessible only to employees or other authorized users.
4. List any five issues of Data Management. (5 marks)
Answer:
Low leverage of data assets
Decentralized Data Management
Data Security
Audit ability
Inefficient use of Resources
5. What does TCP/IP stand for? (1 mark)
Answer:
TCP/IP stands for Transmission Control Protocol/Internet Protocol, which is a set of networking protocols that allows two or more computers to communicate.

CS101 Paper#9 (Solved)

1. In programming, what is an object? (1 mark)
Answer:
It is a named collection of properties and methods.  

2. What kind of information can be stored in a database? (1 mark)
Answer:
It can store numbers, boleans, sound, video, images etc.

3. Define the key weakness of the web? (2 marks)
Answer:
Initially web was designed only for humans to read not for computers to understand it.
4. How can we define a Pixel? (3 marks)
Answer:
It is the smallest element of image which is spread with regular array on display and each element consist of particular color.
5. How marketing strategies are changed with the progress in computing? How new marketing strategies are implemented? (5 marks)
Answer:
Marketing Strategy Changes with the new requirements of the modern era and the applications of the business. The web has changed marketing strategy from a mass focus to single person focus. We collected data and analyze accordingly to find out the behavior of the market and end users. In new marketing more advertising is being done through email and web and get feedback. 
 
6. Write a brief note on each of the following. (10 marks)
FTP
Telnet
Instant messaging
VOIP
Answer:
FTP: File Transfer Protocol: This protocol is used to upload and download the files on remote computers.

Telnet:  FTP allows file operations only while Telnet can log on to a computer of other users through TCP/IP network and use like a local user, it help in testing of remote web server.

Instant Messaging: This is the service of messaging provided on the internet like MSN messenger, Yahoo messenger, through which we interact people randomly whenever required. 

VOIP: Voice over IP, It is used to transmit the voice from one IP to another IP, In which voice is first broken down and then transmitted over a network.

7. What are Commonsense Guidelines to avoid viruses? Discuss about Antivirus as well. (10 marks)
Answer:
Commonsense Guidelines to avoid viruses are as follows:
Do not open attachment of unwanted emails.
Don’t used copied/pirated Software
Regularly place data somewhere as backup
Use Registered and Trusted Software only.
Install Antivirus in the system
Update your Windows and software with the passage of time.
Scan before using any external device with your system as USB Device.
Antivirus:
This is the software design for preventing your system from harmful effects and maintain the speed of computer. This software is available on the CD’s and DVD’s. These software continuously monitor the systems and aware when any harmful virus is detected and asked for the further operations. Some automatically remove the viruses from the system.

CS101 Paper#10 (Solved)


1. What is bandwidth? (1 mark) 
Answer:
 Bandwidth  is a capacity of communication channel of carrying data.
 
2. What is “My Personal Agent”? (1 mark)
Answer:
A computer program that work automatically and have voice interface
    
3. For what purposes FTP is used in networks ? (1 mark)
Answer:
To download or upload files / data to a remote computer
    
4. How can you define a readable program? (2 marks)
Answer:
A program that is easy to read & understand also easy to maintain and enhance.
    
5. What is the preferred organizational structure for the organization? (2 marks)
Answer:
The Network Organization: It is becoming the preferred organizational structure.
    
6. How can you define a consistent web design? Why is it needed? (3 marks)
Answer:
A consistent web design is Easy understandable, not with heavy graphics, easy navigation. It is needed because most of the website views leave the site because of poor navigation and not easy to understand, text and design is not clear etc.
   
7. Elaborate Vector or Object oriented graphics with atleast one example. (3 marks)
Answer:
            Vector treats everything that is drawn as object, they are resolution in dependent and relatively small file size. For example swg, svg, wmf.
    
8. What are the advantages of multimedia presentations? Write any five. (5 marks)
Answer:
Multimedia presentation is a great tool for effective communication:
Advantages:
Easy to make last minute change
More attractive
Can include animation, videos etc.
Better presentation easy to understandable for participants comparing to manual presentation.
Undo feature
    
9. Can a human doctor be replaced by an Expert System? Give reasons to support your answer. (5 marks)
Answer:

Expert System is a computer system which simulates the knowledge and expertise of a human expert. Yes, a human doctor can be replaced by an Expert System. Following are the reasons to support my answer:
A large database of knowledge can be added to and kept up to date; it can store more knowledge than a person.
The Expert System cannot FORGET or get facts wrong.
It survives forever. There is no loss of knowledge as there is when a doctor retires.
The Expert System can access specialist knowledge that a doctor may not have.


10. Explain the following issues of Data Management? (3+4+3)

Data entry
Data updates
Data security
Answer:

DATA ENTRY:
There is new data entered  every day.
New customers are added every day.
Some of the data entry requires the manual entry into computer system
New data entry needs to be entered correctly

DATA UPDATES:
Old titles must be removed regularly
Data changes every time
Prices change
Transportation / shipping cost changes
Customer personal data changes
Schemes changing, new offers
Every new entry needs to be entered correctly

DATA SECURITY:
All data in the system is very critical to its operation, the security of the customer’s personal data is most important. Most of the hackers are always trying for that type of information specially Credit Card Numbers.
This problem can be managed by using proper security arrangements and mechanisms that provides access to only authorized entities. System Security can be improved through, encryption, firewalls and updated Antivirus Softwares


CS101 Paper#11 (Solved)

  
1. Write a note on the followings (10 marks)

Image Preloading process
Animated Gifs
Answer:

IMAGE PRELOADING PROCESS:

The primary use of image preloading process is to download the image into the cache before it is actually needed to display.

PROCESS:
An example of the image object is shaped using the NEW keyword
The src property of this instance is set equal to the filename of the image to be pre-loaded
This step starts the down-loading of the image into the cache without actually displaying
When a pre-loaded image is required to be displayed, the src property of the displayed image is set to the src property of pre fetched image


ANIMATE GIFS:

We can save 16 gif images of the previous example in a single file in the form of an animated gif, and then used it in a regular tag to display a moving image. However, JavaScript provide better control over the sequencing and the gap between the individual images.


2. What are application software? List down the names of three application software (3 marks)
Answer:

Definition: Application Software are that software then can interact directory with the user for performance of respective type of work.

Following are the types of Application Soft wares:-

AutoCAD and Corel Draw
Business Software
Productivity SW
Games Software

3. Why Local variable is preferred over Global variable? (5 marks)
Answer:
In my point of view Global variable has some advantage with Local variables is preferred due to the following reasons:-

When we declare any global variable in web page then in case of error and logic it’s very difficult to see on which line this variable is used and what’s his value if we have more than 2000 lines and all the functions in web page using that Global Variable so Global variables can make the logic of a Web page difficult to understand. 

As we know we can use Global variable everywhere so Global variables also make the reuse and maintenance of your code much more complex.


4. In JavaScript, what is event handling? What are the two types of events? (5 marks)
Answer:
In java script we can capture events on do some operation on the basis of that particular event. For example we want to load some data on web page then with the help of event handling we can do this operation by using onLoad event. 
We can put Event handlers in the body of web page and also in attributes of HTML. From the attribute we can call any JavaScript function that will do his operation and come back. Now we can also interact with server side with the help of AJAX in JavaScript function.

In-Line Event Handling

We can place event handlers in the BODY part and also in HTML attributes the event handlers attributes consist of 3 parts the event handler, equal sign and a string of JavaScript statement enclosed in quotes (single or double). And one more thing these should be put in one line without newline due to this sophisticated event handling is not possible with in-line event handling.

Post a Comment

0 Comments

Close Menu