Академический Документы
Профессиональный Документы
Культура Документы
M I C R O S O F T
L E A R N I N G
2667A
P R O D U C T
Introduction to Programming
Companion Content
Information in this document, including URL and other Internet Web site references, is subject to change
without notice. Unless otherwise noted, the example companies, organizations, products, domain names,
e-mail addresses, logos, people, places, and events depicted herein are fictitious, and no association with
any real company, organization, product, domain name, e-mail address, logo, person, place or event is
intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the
user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in
or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical,
photocopying, recording, or otherwise), or for any purpose, without the express written permission of
Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property
rights covering subject matter in this document. Except as expressly provided in any written license
agreement from Microsoft, the furnishing of this document does not give you any license to these
patents, trademarks, copyrights, or other intellectual property.
The names of manufacturers, products, or URLs are provided for informational purposes only and
Microsoft makes no representations and warranties, either expressed, implied, or statutory, regarding
these manufacturers or the use of the products with any Microsoft technologies. The inclusion of a
manufacturer or product does not imply endorsement of Microsoft of the manufacturer or product. Links
may be provided to third party sites. Such sites are not under the control of Microsoft and Microsoft is not
responsible for the contents of any linked site or any link contained in a linked site, or any changes or
updates to such sites. Microsoft is not responsible for webcasting or any other form of transmission
received from any linked site. Microsoft is providing these links to you only as a convenience, and the
inclusion of any link does not imply endorsement of Microsoft of the site or the products contained
therein.
2002 Microsoft Corporation. All rights reserved.
Microsoft and the trademarks listed at
http://www.microsoft.com/about/legal/en/us/IntellectualProperty/Trademarks/EN-US.aspx are trademarks
of the Microsoft group of companies. All other marks are property of their respective owners.
Module 1
Introduction to Computer Programs
Contents:
Question and Answers
1-1
1-2
Introduction to Programming
2.
2.
1-3
2.
1-4
Introduction to Programming
1-5
Introduction to Scripting
Module 2
Introduction to Scripting
Contents:
Question and Answers
2-1
2-2
Introduction to Programming
Client-side scripts
Server-side scripts
Client-side scripts are run by the Web browser whereas server-side scripts are run on the Web
server.
Question: You have been asked to format a number of Word documents in a similar manner. How would
you speed up the formatting and ensure that the documents are formatted correctly?
Answer: Create macros to automate the formatting tasks.
Question: How can you automate an administrative task, such as configuring the profiles of all the
employees in your organization?
Answer: You can create and use a Windows script to perform the task.
Module 3
Using Data and Variables
Contents:
Question and Answers
3-1
3-2
Introduction to Programming
IntA = 3
IntB = 4
IntC = 4
IntD = 5
Question: Predict the results for the comparisons listed in the following table.
Comparison
Results
Answer
True
IntB = IntD
Answer
False
IntB != IntC
Answer
False
Answer
False
Answer
True
IntB = IntC
Answer
True
Loop variables
Summation variables
Program variables
Question: To assign meaningful names to variables, what naming conventions do you follow?
Answer: The first letter of the variable must indicate the data type. Use n for numeric variables
and c for character variables. The name of the variable should reflect the value that it is storing.
For example, the variable nAge can be used to store a numeric value of age.
3-3
3-4
Introduction to Programming
Question: You must declare all variables before you can use them so that memory is allocated before it is
used in a program. Does the order in which you declare the variables matter?
Answer: No. However, a variable cannot be used if it is not declared already.
Question: What are operators?
Answer: Operators are symbols or other characters that indicate an operation that acts upon one
or more elements.
Question: What are keywords?
Answer: Keywords are reserved words in any programming language that have a special meaning.
Question: Which data type would you use for storing country codes for telephone numbers? For
example, 1 for United States.
Answer: Numeric
Module 4
Using Program Logic
Contents:
Question and Answers
4-1
4-2
Introduction to Programming
4-3
Answer:
cPassword = "northwind"
else
Question: For applications that accept input data from the user, you must validate the data. For example,
an application requires the name and test score of an employee and displays a message depending upon
the test score. Complete the pseudocode to evaluate written test scores and display the messages based
on the values given in the following table.
Criteria
Message
Pass
Fail
Answer:
nScore >= 40 and nScore <= 100
nScore > 100
4-4
Introduction to Programming
Question: You must run a set of statements repeatedly until the user decides to discontinue. Which loop
do you use to solve this problem?
Answer: When you do not know how many times that you must repeat a task, use the WHILE loop.
Question: What are the different types of looping constructs? What are the guidelines for using each
type?
Answer: There are two types of looping constructs: the FOR loop and the WHILE loop. Use the FOR
loop when the number of iterations is known beforehand. Use the WHILE loop when you do not
know how many times a loop must execute.
Question: What are logic errors?
Answer: Logic errors arise because of incorrect implementation of business rules or incorrect
program logic. They may cause an abnormal termination of the program or cause the program to
return abnormal results.
4-5
4-6
Introduction to Programming
Note The solution code for this exercise is provided in the Mod4_Ex1.txt file in the
install_folder\Labfiles\Lab04\Solution folder.
Module 5
Using Procedures and Functions
Contents:
Question and Answers
5-1
5-2
Introduction to Programming
Sub procedure
Function procedure
Property procedure
Question: What is the main difference between a Sub procedure and a Function procedure?
Answer: A Function procedure has a return type and always returns a value. A Sub procedure does
not have any return type and does not return a value.
Question: Give examples of functions.
Answer:
String function
Len function
Left function
Trim function
Question: The Function procedure sends back a value to the calling program. What is that value called?
Answer: Return value
Question: What is the syntax for a Sub procedure?
Answer:
[accessibility] Sub subname[(argumentlist)]
' Statements of the Sub procedure go here
End Sub
Module 6
Introduction to Developing a User Interface
Contents:
Question and Answers
6-1
6-2
Introduction to Programming
Module 7
Introduction to Working with Data
Contents:
Question and Answers
7-1
7-2
Introduction to Programming
Exercise 2
In this exercise, you will identify the attributes for the entity that you have identified.
Exercise 3
In this exercise, you will represent the entity and its attributes in the form of a table.
EmployeeName
Address
City
Zip
Country
Phone
Qualification
BirthDate
Sex
Designation
EmailID
Dept
Region
Photograph
JoiningDate
ResignationDate
7-3
7-4
Introduction to Programming
Answer: A candidate key is an attribute or set of attributes that uniquely identifies a row in a data
table. A candidate key is also called a surrogate key.
Question: Define XML.
Answer: XML is a markup syntax that defines the structure of data in an open and self-describing
manner. XML enables you to transfer data easily over a network and ensure that the data is
processed consistently by the applications that use it. Because XML is used to describe and
structure information, XML is like a data-description language. You can use XML to describe data
components, records, and other complex data structures, such as purchase orders, catalogs, and
documents.
Programming Approaches
Module 8
Programming Approaches
Contents:
Question and Answers
8-1
8-2
Introduction to Programming
State
Behavior
Identity
Module 9
Introduction to the Software Development Process
Contents:
Question and Answers
9-1
9-2
Introduction to Programming
To provide a simple and ready-to-use expressive modeling language that enables the user
to visualize, develop, and exchange meaningful models of a system
To integrate best practices of other modeling approachesTo help all software system
stakeholders understand how the system will work and what options are available
A set of notations and rules for modeling software systems of varying complexities
The creation of simple, well documented, and easy to understand software models
Question: Which UML diagram represents a set of classes, and the messages sent and received by those
classes?
Answer: Collaboration diagram
Question: What are actors?
Answer: Actors are elements that are outside the system. They are also called the external entities
of a system. External entities that do not interact directly with the system are not actors.
Question: List the categories of actors.
Answer: There are four categories of actors: principal actors, secondary actors, external hardware,
and other systems
Question: What is a use case?
Answer: A use case is a set of transactions that the system performs when an actor initiates an
event or action. Use cases represent all the possible events that can occur in all possible scenarios.
They represent all interactions that can take place between an actor and the system.
9-3
Introduction to Programming
1-1
Note Not all training products will have a Knowledge Base article if that is the case, please ask
your instructor whether or not there are existing error log entries.
Courseware Feedback
Send all courseware feedback to support@mscourseware.com. We truly appreciate your time and effort.
We review every e-mail received and forward the information on to the appropriate team. Unfortunately,
because of volume, we are unable to provide a response but we may use your feedback to improve your
future experience with Microsoft Learning products.
Reporting Errors
When providing feedback, include the training product name and number in the subject line of your email. When you provide comments or report bugs, please include the following:
Document
Please provide any details that are necessary to help us verify the issue.
Important All errors and suggestions are evaluated, but only those that are validated are added
to the product Knowledge Base article.