CS101 Solved Subjective Part Midterm File
CS101 Solved Subjective Part Midterm File
Primary Key is a field that uniquely identifies each record stored in a table
Image Processing:
graphics
System
System Architecture
The structure
Write JavaScript code to convert the number 236.2363611111556 into currency format and
JavaScript statement to show output.
a = 236.2363611111556;
b = a.toString( ) ;
c = b.substring( 0, decimalPos + 3 ) ;
document.write( c ) ;
document.write("<br />");
What is a Relational Database? Give the names of any three RDBMS software. (2+3)
Relational Databases
• Databases consisting of two or more related tables are called relational databases
• A typical relational database may have anywhere from 10 to over a thousand tables
• Each column of those tables can contain only a single type of data (contrast this
• Table rows are called records; row elements are called fields
• A relational database stores all its data inside tables, and nowhere else
• All operations on data are done on those tables or those that are generated by table
operations
RDBMS
databases
• Examples:
–Access
–FileMaker Pro
–SQL Server
–Oracle
Object
Event Handler
Local Variable
Scope of Variable
Array
Object
Event Handler
An event handler is a command which calls a function when an event happens, such as the
user clicking a button
Local Variable
Declaring variables (using the var keyword) within a function, makes them local•They are
available only
Scope of Variable
defining the scope of a variable. A variable can be either local or global in scope
Array
Answer:. A staretegy in which all possible combinations are examined and best among
them is selected. Brute force (also known as brute force cracking) is a trial and error
method used by application programs to decode encrypted data such as passwords or Data
Encryption Standard (DES) keys, through exhaustive effort (using brute force) rather than
employing intellectual strategies.
Answer: Control unit is a computerized part of the speech processor. Most of the controls,
such as program, volume and sensitivity, are located on the control unit.
Answer: Structured Design: Materials and member type, size, and configuration to carry
loads in a safe and serviceable fashion.
In general, structural design implies the engineering of stationary objects such as buildings
and bridges, or objects that may be mobile but have a rigid shape such as ship hulls and
aircraft frames tructural design involves at least five distinct phases of work, project
requirements, materials, structural scheme, analysis, and design
It is insufficient in most cases, for the designer to consider a solution, a design. He should
evaluate several alternate designs and choose the best in the sense of maximizing such
technical objectives as efficiency, reliability, and maintainability while satisfying such
design constraints as memory size and response time.
Question No: 31 ( Marks: 5 )
What is Turing machine? Who invented it and also explain how a Turing test is conducted?
The Turing test is a proposal for a test of a machine's ability to demonstrate intelligence. It
proceeds as follows a human judge engages in a natural language conversation with one
human and one machine, each of which tries to appear human. All participants are placed
in isolated locations. If the judge cannot reliably tell the machine from the human, the
machine is said to have passed the test. In order to test the machine's intelligence rather
than its ability to render words into audio, the conversation is limited to a text-only channel
such as a computer keyboard and screen.
If a computer pass the test ,we can say that a machine can think.
Answer: The raw data that make up the root of data types are called "literals." These are,
in effect, literally what they represent themselves to be. Numbers, strings, and Boolean
values make up the core set of literals in JavaScript. Little mystery exists with literals, but
important differences exist between them. In JavaScript, data types include strings, which
are simply quoted characters, numbers, Boolean, Objects and even a type which has no
value at all, Null. Since JavaScript is a loosely typed language, you don't neccessarily need
to know what type of data every value is (although it certainly helps).
Every piece of data in these categories is known as a value. When a value is referred to
outright in a statement, it is called a literal value. For the same reason people are identified
by names as opposed to "human" or "person", literal values can be named in order to
make repeated reference to them practical, efficent and readable. These names are called
variables.
Literals can be of several types. Some of them are:
Array Literals
Boolean Literals
Floating-Point Literals
Integers
Object Literals
String Literals
Define URL
URL (Uniform Resource Locator, previously Universal Resource Locator) - is the address of a
file (resource) accessible on the Internet. The type of file or resource depends on the Internet
application protocol.
http://www.yahoo.com
Randomized Algorithm:
Any algorithm whose behavior is not only determined by the input, but also values produced by
a random number generator
These algorithms are often simpler and more efficient than deterministic algorithms for the same
problem. And because of there simplicity they are easier to analyze which is the most important
thing in the decision making of an algorithm.
Question No: 29 ( Marks: 2 )
What was the name of first super computer. When it was introduced?
The designed first conceives about the High level design and then further designs the details of
the high level design components and it goes on and on.
Making small changes in the functionality of the systems sometimes leads to major re-design
exercise. Structured design separates the functionality from programs data and that’s why
program’s deisgned by this methodology are difficult to maintain.
Why microprocessor uses the binary number system and not the decimal or any other number
system?
The processor is the logic of a computer and functions comparably to a human central nervous
system, directing signals from one component to another and enabling everything to happen. A
microprocessor is made from miniaturized transistors and other circuit elements on a single
semiconductor integrated circuit (IC) . These are made up oof semiconductor and silicon.
Microprocessor are composed of components which has only two states either 0 or 1. Binary
number system is also composed of these two states.
Microprocessor till today only understand the machine language and machine language is only
based on binary number system. Even today’s 64 bit microprocessors are also based on this
technology.
1. Interactive forms are used to gather user data and interact with the user.
2. Forms can be made interactive with the use of client side scripting and server side
sciprting.
3. In HTML, <FORM> </FORM> tag is used to insert the form in a web page and it always
lie in <BODY></BODY> html tag.
4. without form’s web site is only “READ ONLY”.
5. with the help of forms a user and can search the contents, place order for goods and
services.
6. Forms can be simple or very complex, based on the requirement.
7. forms can contain a single element or many e.g text area, buttons
In computer science a for loop is a programming language statement which allows code to be
repeatedly executed. A for loop is classified as an iteration statement.
Arrays are heterogeneous in java script because at the same time stimultanously they can hold
elements of multiple data types
Data base is a collection of organized data in a proper way that computer can quickly search for
any desired data item , its an easy way of allowing of manipulation of data,they are design in
such a way that access to any desired data can be identified and reached quickly and easy , they
are generally consist of collection of interrelated files
Lan can be used in a specific areas with limited computers where as wan can be used on
computers shared by large distances
For example lan can be used on pc s or an organization located in one building but wan can be
used on large scales like banks all over or in any Large communication systems
Trojen horses are a kind of cyber crime , they are v harmful to computer because they are stand
alone programme and the look like what they are not like any thing amusing or not harmless like
games..
A raster graphics image, digital image, or bitmap, is a data file or structure representing a
generally rectangular grid of pixels, or points of color, on a computer monitor, paper, or other
display device.
Look closely at it... Take a magnifying glass to it if you like. You see a "J", the computer sees
something more like this, where '.' represents a zero and 'X' represents a one:
....X
....X
....X
....X
....X
....X
....X
X...X
X...X
.XXX.
Where you see a zero, the computer instructs its video hardware to paint the current background
color. A one calls for the current foreground color. Yes, it is actually a bit more complicated, but
it all basically boils down to one bit or the other making a distinction
What are the important properties, methods and event handlers of image object?
The primary use of the image object is to download an image into the cache before it is needed to
display , image object can be used to create different kinds of animations or to display one of
several images based on the desired requirement , in java script image object can be used to
display the required pre loaded image
Properties of image object is : height , width ,hspace ,vspace , src , name border etc
Methods :none
Event handlers:on aboart , onload, onerror etc
Write the JavaScript code for the Function SumOddNumbers(maxNumber) that can add non-
negative odd numbers up to maxNumber and return their sum.
For(i=0; <maxNumbers;I++)
{
if(i / 2 == 1 || i == 1)
sum += i;
}
return sum;
Write a note on :
Coding guidelines
Guidelines for developing short programs.
Coding guidelines
• Always use semicolons to end statements
• Indent blocks of code (2 to 5 spaces)
• Identifiers
• Use the camel back scheme
• Variables: nouns
• Functions: verbs
• Comment Liberally
• Make them descriptive but concise
Gudelines for developing short programs.
A:In Vector or object oriented graphic everything drawn is treated as object. objects retain their
identity after they are drawon. these objects can later be moved, stretched, duplicated,
deleted,etc. they are resolution independent and have relatively small file size. the examples are:
swf, svg, wmf, ps
brass_ibrahim: Vector graphics is the use of geometrical primitives such as points, lines, curves,
and shapes or polygon(s), which are all based on mathematical equations, to represent images in
computer graphics.
brass_ibrahim: The term "vector graphics" is mainly used today in the context of two-
dimensional computer graphics Virtually all modern 3D rendering is done using extensions of
2D vector graphics techniques .Virtually all modern 3D rendering is done using extensions of 2D
vector graphics techniques
If an object is drawn on top of another, it is difficult to move just one of them while
If an object is drawn on top of another, it is difficult to move just one of them while
event handling?
over the thumbnail. Write complete html and java script? Marks 10
1. How many members are in operational team and what there key resposibilities
5. Breifly describe
Telnet
VoIP
Instant Messaging
FTP
IP/TCP
8. Pixel?
Today I had CS 101 Paper.There were 41 questions.30 objective and 11 descriptive.Few of the
questions were:
Function
TCP/IP
Spreadsheets
Hierarchy in an organization
Team lead
COO
Developer
'+' operator
Image in Javascript
Answer..
System SW
System software is responsible for controlling, integrating, and managing the individual
System software performs tasks like transferring data from memory to disk, or rendering
text onto a display Specific kinds of system software include loading programs, operating
Software libraries that perform generic functions also tend to be regarded as system
termed firmware. These generally perform the background tasks in a computer. These
Application SW
Programs that generally interact with the user to perform work that is useful to the user.
These programs generally talk to the HW through the assistance of system SW.
What is the major difference between paragraph <p> and Line Break <BR> tags?
<P> … </P>
Paragraph
<BR>
Line break
Why PASCAL was designed and what is the problem with PASCAL?
Answer,,
Pascal is very good for writing well-structured and readable programs, but it is not as
C++ embodies powerful object-oriented features, but it is complex and difficult to learn
What changes in the field of computer languages can we expect in the near future
Answer..
E-Commerce Software
Key requirements:
Reliability
Security
Write down the pseudo code for the following flow chart.
Flowcharts
Actual code
Pseudo Code
Answet..
Reduced server load as it does not have to send messages to the user’s browser about
Reduced network traffic as the form’s data is sent only once instead of many to’s and
fro’s
Answer…
When choosing among competing, successful solutions to a problem, choose the one which is
the least
complex
This principle is called the “Ockham’s Razor,” after William of Ockham - famous 13-th
Explain briefly the different techniques that are used to embed JavaScript code in a web
page?
The following sections document each of these JavaScript embedding techniques in more detail.
Together, they explain all the ways to include JavaScript in web pages -- that is, they explain the
allowed structure of JavaScript programs on the client side
Answere
language
compilation stage during which the whole of the high-level code is translated into
machine instructions in one go. This process can be time-consuming if the program is
long.
The interpreter can immediately execute high-level programs, without waiting for the
During the 1960's, computer processors were often constructed out of small and medium-scale
ICs containing from tens to a few hundred transistors. The integration of a whole CPU onto a
single chip greatly reduced the cost of processing power. From these humble beginnings,
continued increases in microprocessor capacity have rendered other forms of computers almost
completely obsolete (see history of computing hardware), with one or more microprocessors
used in everything from the smallest embedded systems and handheld devices to the largest
mainframes and supercomputers.
Since the early 1970s, the increase in capacity of microprocessors has been a consequence of
Moore's Law, which suggests that the complexity of an integrated circuit, with respect to
minimum component cost, doubles every two years
In the late 1990s, and in the high-performance microprocessor segment, heat generation (TDP),
due to switching losses, static current leakage, and other factors, emerged as a leading
developmental constraint
2) If we want to add the value of C2 to the value of C4 and than multiply by C6 , the formula is
written for
1.answer formula
SW Life-Cycle
It is important to think about all those phases before the design work starts
A Case in Point
I didn’t discuss with the customer the specs of the HW & OS before developing a
Unfortunately that HW/OS combination differed from what was easily available to the
client Result: Huge amount of rework. Higher cost. Delayed delivery. Lower quality.
Therefore, now before designing a SW system, I first write down the installation manual,
and get it OK’d by the customer. I do the same with the Operation & Maintenance
manual as well.
An algorithm that always takes the best immediate, or local solution while finding an
answer
Greedy algorithms may find the overall or globally optimal solution for some
optimization problems, but may find less-than-optimal solutions for some instances of
other problems
KEY ADVANTAGE: Greedy algorithms are usually faster, since they don't consider the
During one of the international cricket tournaments, one of the teams intentionally lost a
If they had won that particular match, some other team would have qualified
A skier skiing downhill on a mountain wants to get to the bottom as quickly as possible
The greedy-algorithm approach will be to always have the skies pointed towards the
delete text: Allows you to erase characters, words, lines, or pages as easily as you can cross them
out on paper.
cut and paste : Allows you to remove (cut) a section of text from one place in a document and
insert (paste) it somewhere else.
page size and margins : Allows you to define various page sizes and margins, and the word
processor will automatically readjust the text so that it fits.
search and replace : Allows you to direct the word processor to search for a particular word or
phrase. You can also direct the word processor to replace one group of characters with another
everywhere that the first group appears.
word wrap : The word processor automatically moves to the next line when you have filled one
line with text, and it will readjust text if you change the margins.
file management : Many word processors contain file management capabilities that allow you to
create, delete, move, and search for files.
font specifications: Allows you to change fonts within a document. For example, you can specify
bold, italics, and underlining. Most word processors also let you change the font size and even
the typeface.
footnotes and cross-references: Automates the numbering and placement of footnotes and
enables you to easily cross-reference other sections of the document.
graphics graphics: Allows you to embed illustrations and graphs into a document. Some word
processors let you create the illustrations within the word processor; others let you insert an
illustration produced by a different program.
headers , footers , and page numbering: Allows you to specify customized headers and footers
that the word processor will put at the top and bottom of every page. The word processor
automatically keeps track of page numbers so that the correct number appears on each page.
layout : Allows you to specify different margins within a single document and to specify various
methods for indenting paragraphs.
macros : A macro is a character or word that represents a series of keystrokes. The keystrokes
can represent text or commands. The ability to define macros allows you to save yourself a lot of
time by replacing common combinations of keystrokes.
merges: Allows you to merge text from one file into another file. This is particularly useful for
generating many files that have the same format but different data. Generating mailing labels is
the classic example of using merges.
spell checker : A utility that allows you to check the spelling of words. It will highlight any
words that it does not recognize.
tables of contents and indexes: Allows you to automatically create a table of contents and index
based on special codes that you insert in the document.
thesaurus: A built-in thesaurus that allows you to search for synonyms without leaving the word
processor.
Write the
Answer..
System SW
individual
System software performs tasks like transferring data from memory to disk, or
rendering
text onto a display Specific kinds of system software include loading programs,
operating
Software libraries that perform generic functions also tend to be regarded as system
usually
termed firmware. These generally perform the background tasks in a computer. These
Application SW
Programs that generally interact with the user to perform work that is useful to the
user.
These programs generally talk to the HW through the assistance of system SW.
What is
the major difference between paragraph <p> and Line Break <BR> tags?
<P> … </P>
Paragraph
<BR>
Line break
Why
Answer,,
Pascal is very good for writing well-structured and readable programs, but it is not as
learn
What changes in the field of computer languages can we expect in the near future
Answer..
E-Commerce Software
Key requirements:
Reliability
Security
Write
Flowcharts
Actual code
Pseudo Code
(a) Write
Answet..
Reduced server load as it does not have to send messages to the user’s browser about
missing or incorrect data
Reduced network traffic as the form’s data is sent only once instead of many to’s and
fro’s
Explain briefly the different techniques that are used to embed JavaScript code in a
web page?
number of ways:
or onmouseover
more detail. Together, they explain all the ways to include JavaScript in web pages --
that is, they explain the allowed structure of JavaScript programs on the client side.
Answere
then
machine
language
compilation stage during which the whole of the high-level code is translated into
machine instructions in one go. This process can be time-consuming if the program is
long.
The interpreter can immediately execute high-level programs, without waiting for the
microprocessors emerged in the early 1970s and were used for electronic calculators,
using binary-coded decimal (BCD) arithmetic in 4-bit words. Other embedded uses of
automation etc, followed soon after. Affordable 8-bit microprocessors with 16-bit
addressing also led to the first general-purpose microcomputers from the mid-1970s
on.
During the 1960's, computer processors were often constructed out of small and
medium-scale ICs containing from tens to a few hundred transistors. The integration
of a whole CPU onto a single chip greatly reduced the cost of processing power. From
computing hardware), with one or more microprocessors used in everything from the
smallest embedded systems and handheld devices to the largest mainframes and
supercomputers.
Since the early 1970s, the increase in capacity of microprocessors has been a
circuit, with respect to minimum component cost, doubles every two years
generation (TDP), due to switching losses, static current leakage, and other factors,
1.answer formula
How can we enter data in more than one line in an html form?
Question No: 22 ( Marks: 5 )
SW Life-Cycle
It is important to think about all those phases before the design work starts
A Case in Point
I didn’t discuss with the customer the specs of the HW & OS before developing a
Unfortunately that HW/OS combination differed from what was easily available to
the
client Result: Huge amount of rework. Higher cost. Delayed delivery. Lower quality.
Therefore, now before designing a SW system, I first write down the installation
manual,
and get it OK’d by the customer. I do the same with the Operation & Maintenance
manual as well.
Elaborate greedy algorithm definition with solid example in favour and one counter
example?
An algorithm that always takes the best immediate, or local solution while finding an
answer
Greedy algorithms may find the overall or globally optimal solution for some
optimization problems, but may find less-than-optimal solutions for some instances of
other problems
KEY ADVANTAGE: Greedy algorithms are usually faster, since they don't consider
the
During one of the international cricket tournaments, one of the teams intentionally
lost a
If they had won that particular match, some other team would have qualified
possible
The greedy-algorithm approach will be to always have the skies pointed towards the
1. ctrl + c
2. ctrl + b
3. ctrl +v
Do you think greedy algorithm is best? if yes give solid reason. 3marks
1. In flow charts, there is only one entry point in conditions while there is/are__________
exit points.
►1
►2
►3
►4
Notepad is an example of:
System software
Application software
Device driver
Kernel
Mechanical
Electronic
Electrical
Bothe Mechanical and Electronic
1. If user is using CGI script on a UNIX server, then the script type is called:
Client-side scripting
Server-side scripting
Stand alone
GUI Scripting
1. Choose the correct sequence of the technologies used int eh evolution of the computers
from starting to today:
1. The text written in between ________ is only displayed on the web page.
<BODY></BODY>
<HTML></HTML>
<BODY></HEAD>
<HEAD></HEAD>
1. Enhancement, upgrading and bugfixing are done during _________ step of SDLC.
Maintainance
Planning
Designing
Developer specificaion
1. ________ is more suitable technique for the developer use in order to construct the actual
code of the software.
Pseudo code
Flow cahrt
Algorithm
Heruistic
Harvard Mark –I
ENIAC
ABC
UNVAC-I
<TR>….</TR>
<TD>….</TD>
<BR>….</BR>
<TABLE>….</TABLE>
1. ______ attribute of the FORM tag is used to mention a URL when the form is being
submitted.
Name
USB
Hard Drive
Register
RAM
SUBJECTIVE:
There are some programming languages which could not be used without interpreter. Name any
2 of them. (2MARKS)
How is single line text input field different from password input field in html? (2 MARKS)
Write a function in java script to display “Virtual University of Pakistan” in status bar of your
browser.
(3 MARKS)