COPA
COPA
COPA
Trade Theory
Annual Pattern (As per July 2022 syllabus)
Dr.V.Nagaradjane
October 7, 2022
Syllabus
Safe working practices, Scope of the COPA trade, Safety rules
and safety signs, Types and working of fire extinguishers,
Introduction to Computer components
Safe working practices
1) Do not touch power connections or loose power cables
without permission.
2) Do not eat in the lab space.
3) Keep your water bottles away from computer components like
CPU, monitor, keyboard, mouse, printer, etc.
4) Report any hardware issues immediately to the lab in-charge.
5) Never open surf the Internet in the absence of your faculty/
supervisor.
6) Do not play games on computer.
7) Properly shutdown the computer after completing your works.
8) Do not charge any mobile devices.
9) Keep the lab space clean.
10) Report any abnormal conditions immediately.
Safety Rules
Figure: Windows 10
Mac OS
▶ Apple computers released the first version of GUI based Mac
OS in the year 1984.
(a) Count
(b) Sum
Aggregate functions in MySQL
(c) Average
5 Rectangle Processing
@
@ Decision making (condi-
@
6 @ Rhombus tions - if/ switch, loops -
Introduction to web servers
1 Web server sends HTML pages in response to request from
client. Web server uses Hyper Text Transfer Protocol
(HTTP).
2 Web server uses port number 80 for general data exchange
and port number 443 for data exchange over Secure Socket
Layer (SSL).
3 Scripts executed by the webserver are called server side scripts.
4 PHP, Perl, Python and ASP.NET are some of the
programming languages used for server side scripting.
5 Some scripts embedded in HTML pages are executed by the
browser. The scripts executed on browser are called client side
scripts.
6 Javascript and VBScript are some of the most common client
side scripting languages.
7 Microsoft Internet Information Server (IIS), Apache httpd,
ngingx, Google Web Sever (GWS) and IBM Websphere are
some of the most common web servers.
Features of web server
1 Port numbers 80 and 443 are used by web servers.
2 Web address is called Uniform Resource Locator (URL).
3 URL parts are separated by forward slash (/) symbol.
4 If a URL begins with http:// the communication takes place
on port number 80 and it is unsecure.
5 If a URL begins with https:// the communication takes place
on port number 443. Secure Socket Layer (SSL) protocol is
used to prevent data intrusion.
6 The last part of a web URL is the name of the file.
7 A folder named ‘htdocs’ or ‘wwwroot’ serves as the root
directory of the web server.
Compiler based programming languages
1 The human readable program is called source code.
2 A special program called compiler converts the source code to
machine readable binary code.
3 A source code should follow certain formatting details, called
syntax, if the program should be successfully compiled.
4 Compiler detects errors and converts/ translates the code only
if the entire program has correct syntax.
5 Since compilation is done only once, the time spent on
removing syntax and logical errors (called debugging) does
not affect the time required for running on a computer.
6 After compilation, machine code runs very fast on a computer.
7 Assembly language, C, C++, Java, C#, etc. are some of the
most popular compiled languages.
8 Compiler based languages are very strict about syntax and
data types.
Interpreter based programming languages
1 Interpreter is a special program to translate few lines of source
code, load it to the processor based on program flow.
2 Interpreted programs are slower than compiled programs.
3 Interpreted programming languages enforce liberal syntax
(they forgive some deviations) and have less stringent data
types.
4 Interpreted programs are easier and faster to develop for small
projects.
5 The liberal nature of interpreted programming languages
permits more errors and more complications for large
programs.
6 A class of languages suitable for embedding inside a larger
program are called scripting languages.
7 Javascript, Perl, Python, Unix/Linux shell script, etc. are
some of the most popular scripting languages.
Javascript
1 Javascript loosely follows the syntax of Java programming
language.
2 Javascript is embedded inside HTML code.
3 A Javascript function is embedded inside a pair of
< script > < /script > tags.
4 The script tag begins with one or both of the following
attributes: type=”text/javascript” and
language=”javascript”.
5 Javascript can be used as a procedural language (only
functions are permitted) or as an Object oriented language
(new data types called classes are permitted).
6 Each line of Javascript code ends with a semi-colon (;), unless
it begins a new block using curly brace({).
7 Javascript runs inside a browser.
8 Script can be written within the HTML file itself or in an
external file (with .js extension).
9 External script file (say welcome.js) may be embedded using
Comments in Javascript
1 Comments in Javascript can cover single line or multiple lines.
2 Single line comments start with // symbol and run till the end
of the line in which it is placed. For example,
x*=2; //current value of x is doubled.
//The following code calcualtes age of a person.
are examples of single line comment.
3 Multiple line comment starts with /∗ and ends only when ∗/
is found. For example,
/∗
The following lines are ignored by the browser.
x+=5;
y=Math.pow(x,2);
∗/
is an example of multi-line comment.
5 Commented portions are ignored by the browser.
6 Comments help the programmer to understand the meaning
of code at a later date.
Application of Javascript for web
1 Javascript can be embedded in HTML code.
2 Support for Javascript is available in all the modern web
browsers.
3 Javascript methods can be easily invoked through onClick
property of a button.
4 Javascript can be used to dynamically interact with the user
of a web page.
5 Since Javascript is executed inside a browser, the danger of
malware spreading to the system through the script is very
low.
Data types in Javascript
1 Javascript supports the following primitive (basic level) data
types:
Airthmetic
Sl.
Opera- Purpose Example Precedenc
No.
tor
1 ∗∗ Exponentiation x = 10/2; // x value is 2. 1
2 ∗ Multiplication x = 10 ∗ 2; // x value is 20. 2
3 / Division x = 10/2; // x value is 2. 3
Modulo Re-
4 % x = 10%4; // x value is 2. 4
mainder
5 + Addition x = 10 + 2; // x value is 12. 5
6 − Subtraction x = 10 − 2; // x value is 8. 6
7 ++ Increment x = 10; x + +; // x value is 11. 7
8 −− Decrement x = 10; x − −; // x value is 9. 8
Assignment Operators in Javascript
1 Javascript provides assignment operators to assign the results
of mathematical expression to variables.
Assignment
Sl.
Opera- Purpose Example Precedence
No.
tor
1 = Assignment x = 10; // x value is 10. 1
Add and As- x = 10; x+ = 4; // x value is
2 += 2
sign 14.
Subtract and x = 10; x− = 4; // x value is
3 −= 3
Assign 6.
Multiply and x = 10; x∗ = 4; // x value is
4 ∗= 4
Assign 40.
Take power x = 2; x ∗ ∗ = 4; // x value is
5 ∗∗ = 5
and Assign 16 (∵ 24 = 2x2x2x2 = 16).
Divide and As- x = 10; x/ = 4; // x value is
6 /= 6
sign 2.5
Comparison operators in Javascript
1 Comparison operators compare the left and right side results based
on Boolean logic (true or false) results. List of comparison operators
is shown in Table 10.
Sl.
Operator Purpose
No.
Equal to (ignore data type. e.g., ”20”==20 gives
1 == true as the result, since data types are not consid-
ered.)
Equal to (compare data type and value. ”20” ===
2 ===
20 is false.)
3 != Not equal to. Ignore data type.
Not equal to. Gives true result only when the data
4 ! ==
type and value are identical.
5 > Greater than.
6 >= Greater than or equal to.
7 < Less than.
Logical operators in Javascript
1 Logical operators help to combine the results of several logical
operations (AND, OR, NOT, etc.) based on Boolean logic.
Table 11 shows the logical operators used in Javascript.
Sl.
Operator Purpose
No.
1 && Logical AND.
2 ∥∥ Logical OR.)
3 ! Logical NOT operator (Negation).
Special operators in Javascript
1 Following are some of the uncategorized, but important
operators used in Javascript (Table 12).
Sl.
Operator Purpose
No.
1 typeof Returns the data type of a variable.
2 new Creates a new object.
Evaluates the logical expression to the left of ?.
Executes left side of : if it is true, right side of :
3 ? : ternary otherwise. e.g., var x = 2; y = (x! = 2)?5 : 8;
sets y value to 8, since the logical expression is
false.
Checks whether a variable belongs to particular
4 instanceof
data type.
Takes a value from an array. Used
5 in in for loops. e.g., var x =
′ ′ ′ ′ ′ ′
String operators in Javascript
1 String class supports assignment and string concatenation
operators (Table 13).
Sl.
Operator Purpose
No.
Assigns string value on the right side to
1 = a variable on the left side. e.g., var
name=”Gayathri”.
Adds 2 strings together. var x=”COPA”, y=”
2 + is great.”; var z=x+y; sets ”COPA is great.” as
the value in z.
Appends the string on right side to the variable
on left side. e.g., var x=”Sun”, y=” is the near-
3 +=
est star.”; x+=y; sets ”Sun is the nearest star.”
in variable x.
Arrays in Javascript
1 Array is a collection of values in a single variable.
2 Array elements are numbered from 0 (0,1,2,3,...).
3 Each element of an array may be accessed using []. e.g.
x = {3, 5, 2, 10}; alert(x[1]); displays 5.
4 In a for loop, elements of array may be accessed using index
values (0 to n) or using in operator. e.g.,
x={3,5,2,10};
for(var i=0;i<x.length; i++)
alert(x[i]);
and
x={3,5,2,10};
for(var y in x)
alert(x[y]);
display all the elements array x.
5 Array may be declared using a pair of { } or new Array ();
function.
Associative arrays in Javascript
1 Instead of accessing array elements using a numeric index, it is
possible to permit some name to each element.
2 Such an array having a name for index is called an associative
array or hash map.
3 An associative array may be declared in any one of the
following styles:
var x={’Tamil’:92,’English’:80, ’Maths’:83, ’Science’:87,
’Social Science’:81};
or
var x= new Array(’Tamil’:92,’English’:80, ’Maths’:83,
’Science’:87, ’Social Science’:81);
4 Left side of an associative array or hash is called key and the
right side is called value. e.g., in array x, ’Maths’ is key and
83 is value.
5 Elements of associative arrays are accessed using the key. e.g.,
y = x[′ Tamil ′ ]; sets value of y to 92.
Control statements in Javascript
1 Control statements help in conditional execution of portions
of code.
2 Conditional controls may be imposed using
(i)if...else condition,
(ii)switch ... case ...break condition, or
(iii)ternary operator (?:).
If ... else condition
1 The if condition contains a condition part. In case the
condition is true, the block (enclosed by a pair of { })
immediately following if condition is executed.
2 An if condition having a single line might omit the pair of { }.
3 In case the if condition fails, an optional else block may be
coded. Else may also check for a condition using an if
(else if ).
4 Else block may also omit the pair of { } if the code for it
contains a single line.
Example of if condition
<html>
<head>
<title>Test of if condition</title>
<script type=”text/javascript” language=”javascript”>
function ageMessage() {
var age = this.ageForm.age.value;
if(age < 13) {
document.write(”<h1 style=’color:#FF0000’>You are a kid </h1>”);
}
else if(age < 20) {
document.write(”<h1 style=’color:#FF0000’>You are a teenager! </h1>”);
}
else if(age < 36)
document.write(”<h1 style=’color:#FF0000’>You are young! </h1>”);
else if(age < 50)
document.write(”<h1 style=’color:#FF0000’>You are middle aged! </h1>”);
else
document.write(”<h1 style=’color:#FF0000’>You are old! </h1>”);
}
</script>
</head>
<body>
<form name=”ageForm”>
<center>
Enter your age: <input type=”number” name=”age”></br />
<input type=”button” value=”Get message” onClick=”ageMessage()”>
</center>
</form>
</body>
</html>
How the if condition program works?
1 The if ladder first tests whether the age is less than 13. In
case it is correct, the message ”You are a kid!” is displayed.
2 In case the value is the first test fails (age ¿= 13), the else if
part tests whether the age is between 13 and 19. In such a
case, the message ”You are a teenager!” loads.
3 In case the age is greater than or equal to 20, the third else if
condition checks whether the age is less than 36. If so, the
message ”You are young!” is displayed.
4 In case the age is greater than or equal to 36, the third else if
condition checks whether the age is less than 50. If so, the
message ”You are middle aged!” is displayed.
5 When all the if conditions fail, the last else is reached. It
displays the message ”You are old!”.
Switch condition
1 Switch condition takes one argument (e.g. switch(x)).
2 It checks the input against several case values (e.g., case 2:)
and executes the lines following the matching case.
3 All cases, other than the last one end with break keyword.
4 The last condition may be called default :, which handles
cases not matching any of the previous ones.
<html>
<head>
<title>Test of switch condition</title>
<script type=”text/javascript” language=”javascript”>
function nameMessage() {
var name = this.nameForm.name.value;
var length=name.length;
switch(length) {
case 1:
case 2:
case 3:
case 4:
case 5:
document.write(”<h1 style=’color:#FF0000’>Very short name! </h1>”);
break;
case 6:
case 7:
case 8:
case 9:
case 10:
document.write(”<h1 style=’color:#FF0000’>Length of your name is normal! </h1>”);
break;
case 11:
document.write(”<h1 style=’color:#FF0000’>Your name is bit long! </h1>”);
break;
default:
document.write(”<h1 style=’color:#FF0000’>Your name is too long! </h1>”);
}
}
</script>
</head>
<body>
<form name=”nameForm”>
<center>
Enter your name: <input type=”text” name=”name”></br />
<input type=”button” value=”Get message” onClick=”nameMessage()”>
</center>
</form>
How the switch...case program works?
1 The switch takes length of name as argument.
2 For cases 1, 2, 3, 4 and 5, it displays the message ”Very short
name!”.
3 For cases 6, 7, 8, 9 and 10, it displays the message ”Length of
your name is normal!”.
4 For case 11, it displays the message ”Your name is bit long!”.
5 As the default case (length > 11), it displays the message
”Your name is too long!”.
6 Note that cases and case groups end with break.
7 The last condition (default) need not have a break.
The ternary operator (?:)
1 A simple if ... else condition may be re-written using one liner
called ternary.
2 Ternary operator has 3 parts.
3 First part of the ternary operator (to the left of ?) is the
condition. The condition may be either true or false.
4 The second part of the ternary, placed to the right of ? and
the left of :, is executed if the condition is true.
4 The third part of the ternary, placed to the right of :, is
executed if the condition is false.
5 Consider the following lines:
x = 25;
y = (x < 21)?“Good ′′ : “Bad ′′ ;
can you guess the value of y ?
6 y has the value of “Bad”, since the condition turns out to be
false.
Example of ternary operator (?:)
<html>
<head>
<title>Test of if condition</title>
<script type=”text/javascript” language=”javascript”>
function bmiMessage() {
var wt = this.bmiForm.wt.value,
ht=this.bmiForm.ht.value/100; //Convert height from centimeter to metre.
var bmi=wt/ht/ht;
var mess=”Your BMI is ”;
mess += bmi<=20.3?”very good!”:”very high. You need exercise!”
document.getElementById(”res”).innerHTML=”<h1 color=#FF0000> ”+mess+”</h1>”;
}
</script>
</head>
<body>
<form name=”bmiForm”>
<center>
Enter weight: <input type=”number” name=”wt”></br />
Enter height in centi metre: <input type=”number” name=”ht”></br />
<input type=”button” value=”Get message” onClick=”bmiMessage()”>
<span id=”res”> </span>
</center>
</form>
</body>
</html>
Loops in Javascript
1 Javascript supports 4 types of loops:
(a) for loop with index value.
(b) for − in loop with list of array elements.
(c) while loop.
(d) do − while loop.
2 For loop having index value handle only integer index.
1 Index value of for loop may be declared before
commencement of the loop or at the loop itself. (e.g., var i;
for (i = 0; i < 10; i + +) is equivalent to
for (var i = 0; i < 10; i + +)).
2 The for loop has 3 parts, viz., (i)initialization part,
(ii)condition part, (iii)increment part.
3 The initialization part sets the initial value of index variable.
4 The for loop keeps running so long as the condition part
(second of the three parts) is true.
5 The increment part increases or decreases value of variable.
e.g., for (var i = 0; i < 100; i + +),
for (var i = 0; i < 100; i+ = 2),
for (var i = 100; i >= 0; i − −), for (var i = 0; i < 100; + + i),
for (var i = 0; i < 100; i+ = 10) are all valid increments to the
index variable of for loop.
6 Each of the 3 parts of for loop is separated by a ;
(semi-colon).
7 One of more of the parts of for loop may be omitted.e.g.,
var i = 0; for ( ; i < 10; i + +), for (var i = 0; i < 10; ),
Example of for loop
<html>
<head>
<title>
Example of for loop
</title>
</head>
<body>
<script type=”text/javascript” language=”javascript”>
var x = new Array(4,2,6,8,12,15,25), sum=0;
document.write(”Sum of ”);
for(var i=0; i<x.length; i++) {
document.write(x[i] + (i==x.length-1?” = ”:” + ”));
sum += x[i];
}
document.write(sum);
</script>
</body>
</html>
for − in loop in Javascript
1 for − in loop is used in conjunction with arrays and lists.
2 A typical for − in loop to move through the elements of an
array creates an index variable which changes value from the
first index to the last.
3 The for − in loop is a convenient replacement to for loop
having separate declaration, index limit checking and
increment parts.
Example of for − in loop
<html>
<head>
<title>
Example of for-in loop
</title>
</head>
<body>
<script type=”text/javascript” language=”javascript”>
var x = new Array(4,2,6,8,12,15,25), sum=0;
document.write(”Sum of ”);
for(var y in x) {
document.write(x[y] + ” ”);
sum += x[y];
}
document.write(” is ”+sum);
</script>
</body>
</html>
Mark statement using for − in loop and associative array
<html>
<head>
<title>
Example of for-in loop
</title>
</head>
<body>
<script type=”text/javascript” language=”javascript”>
var x = {’Tamil’:92, ’English’:98, ’Maths’:100, ’Science’:94, ’Social’:91};
var sum=0;
document.write(”<center><h1>Mark statement</h1> <table border=1>”);
document.write(”<tr><th>Subject</th> <th>Mark</th></tr>”);
for(var y in x) {
document.write(”<tr><td>”+y+”</td><td
style=’text-align:right’>”+x[y]+”</td></tr>”);
sum += x[y];
}
document.write(”<tr><td style=’color:#FF0000;
text-align:center’>Total</td><td style=’color:#FF0000;
text-align:right’>”+sum+”</td></tr></table>”);
</script>
</body>
</html>
While loop in Javascript
1 While loop checks a condition. If the condition yields true,
the loop portion is executed.
2 If the loop contains only one statement, use of a pair of curly
braces ({ }) is optional.
3 If the loop contains more than one statement, the entire loop
body is enclosed in a pair of curly braces({ }).
4 Index variable of the while loop should be declared and
initialized before the while loop begins.
5 Index variable, if any, should be incremented or decremented
in a separate line within the while loop.
Example of while loop
<html>
<head>
<title>
Example of for-in loop
</title>
<script>
function table() {
var x=this.document.tabForm.n.value, y, i=1;
document.write(”<center><h1 style=’color:#FF0000’>”+x+” Table</h1><h2>”);
while(i<=10) {
y = i*x;
document.write(i+” x ”+x+” = ”+y+”<br />”);
i++
}
document.write(”</h2></center>”);
}
</script>
</head>
<body>
<center>
<form name=”tabForm” method=”GET” action=”#”>
Enter table number: <input type=”number” name=”n”> <br />
<input type=”button” value=”Create table” onClick=”table()”>
</form>
</center>
</body>
</html>
The do ... while loop in Javascript
1 Do ... while loop is a special loop which gets executed at least
once, because the condition is checked only at the last
statement of the loop.
2 The index variable, if any, should be declared outside the loop.
3 The do ... while loop checks the condition at the last line
(which is a while).
Example of do ... while loop - Fibonacci series <html>
<head>
<title>
Example of do ... while loop
</title>
</head>
<body>
<script>
var i=1, x=1,y=1;
document.write(”<h1 style=’color:#FF0000’>Fibonacci series</h1><br
/>”);
document.write(”<h1 style=’color:#0000FF’>”+i+”) ”+x+”<br />”);
var next=false;
do {
document.write((++i)+”) ”+y+”<br />”);
var z=x;
x=y;
y+=z;
next = confirm(”Do you want the next Fibonacci number”);
}while(next);
document.write(”</h2>”);
</script>
</body>
</html>
Functions in Javascript
1 Generally, functions have 3 components:
(a) The function keyword at the beginning.
(b) The name of function following the function keyword. The
name of function contains pair of brackets (), which might
contain arguments.
(c) Body of the function enclosed in a pair of curly braces ({ }).
The function might use return keyword to return a value after
processing data.
2 In general, a named block of code is called function, which
may be invoked using the given name.
3 A variable declared inside the function dies within that
function.
4 A function may access variables declared inside the function or
with a global scope (outside any function).
5 Any changes made by a function to the global variables is
permanent and is visible in other functions too.
The following code shows 3 functions, having different combination of
arguments and return values. <html>
<head>
<title>
Test of Javascript functions
</title>
<script>
//Function without argument and without return value
function add1() {
var x = prompt(”Enter x”), y = prompt(”Enter y”),
z=Number(x)+Number(y);
alert(x+” + ”+y+” = ”+z);
}
//Function with arguments but without return value
function add2(x, y, z) {
var z=Number(x)+Number(y);
alert(x+” + ”+y+” = ”+z);
}
//Function with arguments and return value
function add3(x, y) {
var z = Number(x)+Number(y);
return z;
}
</script>
Use of function for OOPS in Javascript
1 OOPS stands for Object Oriented Programming System.
2 Object is a programming entity having properties (to store
values) and methods (to work with properties).
3 Javascript supports Object creation using function.
4 A function can be converted to a class definition.
5 Variable declared inside the function is accessed with dot
operator.
6 A method is declared using the expression this.method =
function() {}.
Example of objects using Javascript function <html>
<head>
<title>
OOPS using Javascript
</title>
<script>
function Student(name, dob, grade) {
this.name=name;
this.dob=dob;
this.grade=grade;
this.getName = function() {
return this.name;
}
this.getDOB = function() {
return this.dob;
}
this.getGrade = function() {
return this.grade;
}
this.setGrade = function(gr) {
this.grade = gr;
}
}
</script>
</head>
<body>
<script>
var s1 = new Student(’Desiga’, ’2000-05-12’,’A’),
s2 = new Student(’Gayathri’,’2001-03-01’,’B’);
document.write(”<h1 style=’color:#FF0000’>Before changing grade</h1><h2 style=’color:#0000FF’>”);
document.write(s1.getName()+”: ”+s1.getDOB()+”: ”+s1.getGrade()+”<br />”);
document.write(s2.getName()+”: ”+s2.getDOB()+”: ”+s2.getGrade()+”<br />”);
s1.setGrade(’S’);
s2.setGrade(’A’);
document.write(”</h2><br /><br /><h1 style=’color:#FF0000’>After changing grade</h1><h2
style=’color:#0000FF’>”);
document.write(s1.getName()+”: ”+s1.getDOB()+”: ”+s1.getGrade()+”<br />”);
document.write(s2.getName()+”: ”+s2.getDOB()+”: ”+s2.getGrade()+”<br />”);
Built in JavaScript functions overview
1 Functions which are readily available in the general
environment of Javascript are called built-in functions.
2 Buil-in functions help to process data belonging to the built-in
data types.
3 Built-in functions of Javascript may be categorized under the
following heads:
(a) Number functions
(b) String functions
(c) Array functions
(d) Date functions
(e) Math functions
4 The built-in functions belonging to the above categories are
described in the following sections.
Built-in functions in Number data type
▶ toExponential(): Formats a number in exponential
(X × 10y ) notation.
▶ toFixed(digits): Formats a number with given number of
digits after the decimal point.
▶ toLocaleString(): Formats a number based on browser
geo-location.
▶ toPrecision(digits): Formats the number with given total
number of digits (including those to the left and right of
decimal point).
▶ toString(): Returns String value.
▶ valueOf(): Returns value of the number.
Built-in functions in String data type
▶ charAt(index): Returns character at given index location.
Counting starts from 0.
▶ charCodeAt(index): Returns UNICODE value of the
character at given location. Counting starts from 0.
▶ concat(s1,s2, s3): Joins given Strings (s1, s2, s3, etc.) with
original String and returns the joined String.
▶ indexOf(s1): Returns the location where the given String s1
occurs inside the original String. Returns -1 if no occurrence
of s1 is available inside the original String.
▶ lastIndexOf(s1): Returns the last location where the given
String s1 occurs inside the original String. Returns -1 if no
occurrence of s1 is available inside the original String.
▶ localeCompare(s1): Compares original String and given
String. Returns -1 if the original String sorts before given
String, 0 if both are equal and 1 if the original String sorts
after the given String.
▶ length(): Returns the length of String.
Built-in functions in String data type
▶ match(s1): Compares the original and given Strings based on
regular expression notation.
▶ replace(s1, s2): Search for occurrences of s1 inside the
original String and replace with s2. String s1 may have regular
expression.
▶ search(s1): Searches the original String for the given String
s1. The String s1 may have regular expression.
▶ slice(begin, end): Splits the original String between given
beginning and end points. Returns the split String.
▶ toLocalLowerCase()/ toLocalUpperCase(): Returns lower
case version (or upper case version) according locale String
based on current geo-locale.
▶ toLowerCase()/ toUpperCase(): Returns lower case version
(or upper case version) according locale String.
Built-in functions in Array data type
▶ concat(a1, a2, a3): Appends arrays a1, a2, a3, etc. to the
original array and return the resultign array.
▶ every(function): Returns values which satisfy given function.
The function should return Boolean value.
▶ filter(function): Returns values which satisfy given filter
function. The function should return Boolean value.
▶ forEach(function): Calls given function for each element of
the array.
▶ indexOf(val): Returns the firts occurrence location of the
given value in the original array.
▶ join(): Creates a String using the values of the array.
▶ lastIndexOf(val): Returns the last location at which given
value occurs.
▶ map(function): Calls given function with each element of the
array and returns the results in new array.
Built-in functions in Array data type
▶ pop(): Remove the last element of the array.
▶ push(): Add new element to the end of the array.
▶ reduce(): Apply given function to the right and left elements
and replace them with given result till there remains only a
single element.
▶ reduceRight(): Reduces given array from right to left,
applies given function and returns a single value.
▶ shift(): Removes the first element of the array. Returns the
value of removed element.
▶ slice(begin, end): Splits the array from given beginning
through the given end.
▶ sort(): Sorts elements of the array.
▶ splice(location, length, value): Adds given value at given
location. It removes elements at given location if the length is
greater than 0.
▶ unshift(): Adds one element to the beginning of array.
Built-in functions in Date data type
▶ Date(): Date and time of today and now.
▶ getDate(): Returns day of month (month counting starts at
0).
▶ getDay(): Returns day of week (day count starts at 0).
▶ getFullYear(): Returns year stored in the date object in 4
digit format.
▶ getHours(): Return the time stored in the date object in 24
hour format.
▶ getMilliSeconds(): Returns the millisecond value of time
stored in date object.
▶ getMinutes(): Returns the minutes part of time stored in the
date object.
▶ getMonth(): Returns month value stored in the date object
(month count starts at 0).
▶ getSeconds(): Returns the seconds part stored in the date
object.
Built-in functions in Date data type
▶ getTime(): Returns milliseconds passed since the epoch date
of 01.01.1970 (midnight).
▶ getUTCDate(), getUTCDay(), getUTCFullYear(),
getUTCHours(), getUTCMilliseconds(),
getUTCMinutes(), getUTCMonth(), getUTCSeconds():
get day of month, day of week, year, hours, milli-seconds,
minutes, month and seconds in Coordinated Universal Time.
▶ setDate(dt): Set dt value in the day of month part of date
object.
▶ setFullYear(y): Set y value in full year part of date object.
▶ toDateString(): Returns the date and time values in human
readable string format.
▶ toGMTString(): Returns human readable date and time in
Greenwich Mean Time format.
▶ toLocalFormat(): Converts date to given format string.
▶ toLocaleString(): Returns string value of date to the local
date and time format.
Built-in functions in Date data type
▶ toLocaleTimeString(): Returns time part of the date
according local format.
▶ toSource(): Return string equivalent of date object.
▶ toUTCString(): Returns string value of date object in
Coordinated Universal Time format.
▶ valueOf(): Returns the primitive value of date object.
▶ Date.parse(str): Parse the string and obtain equivalent date
object.
▶ Date.UTC(): Returns milliseconds value based on
Coordinated Universal Time.
Built-in functions in String Math type
▶ Math.abs(x): Returns absolute value of given number,
ignoring + or - signs.
▶ Math.acos(x): Returns arc cosine (cos −1 ) value of x.
▶ Math.asin(x): Returns arc sine (sin−1 ) value of x.
▶ Math.atan(x): Returns arc tangent (tan−1 ) value of x.
▶ Math.atan2(x, y): Returns the arc tangent (tan−1 ) of yx
value.
▶ Math.ceil(x): Returns the integer just greater than given
fraction x.
▶ Math.cos(x): Returns the cosine value of x.
▶ Math.exp(x): Return e x value of x, where e is the base for
Napier’s logarithm (e = 2.718281828459)
▶ Math.floor(x): Returns the integer just lower than the given
fraction x.
▶ Math.log(x): Returns natural logarithm to the base e for the
value of given x.
Built-in functions in Math data type
▶ Math.log10(x): Returns logaithm to the base 10 for value of
x.
▶ Math.max(x,y,z,...): Returns maximum of the given set of
values.
▶ Math.min(x,y,z,...): Returns minimum of the given set of
values.
▶ Math.pow(x,y): Returns x power y (x y ) value.
▶ Math.random(): Returns random number between 0 and 1.
▶ Math.round(x): Rounds given number x to the nearest
integer value.
▶ Math.sin(x): Returns sine value of x.
▶ Math.sqrt(x): Returns square root of x.
▶ Math.tan(x): Returns tangent value of x.
Built-in functions in RegExp data type
▶ RegExp.match(exp): Matches given exp regular expression
against the given string. Returns the matching part.
▶ RegExp.test(exp): Matches given exp regular expression
against the given string. Returns true if a matching part is
found.
Popup boxes in Javascript
1 Popup box opens out of a web page to convey an information,
to confirm an action or to obtain an input.
2 Following types of popup boxes are supported by Javascript:
(i) alert(message): Displays given message through a popup
dialog.
(ii) confirm(message): Confirms whether given option should be
OK or Cancel.
(iii) prompt(message, default): Prompts for an input by
displaying a message and a default value (optional).
Example of dialogs in Javascript
<html>
<head>
<title>Dialogs in Javascript</title>
</head>
<body>
<script>
var x = prompt(”Enter x:”,”10”);
var y = prompt(”Enter y:”,”20”);
if(confirm(”Do you wish to add the numbers?”)) {
var z = Number(x)+Number(y);
alert(x+” + ”+y+” = ”+z);
}
else
alert(”You have chosen not to do anything with the given
numbers”);
</script>
</body>
Document Object Model (DOM)
1 Accessing elements of a web page as though they belong to a
document (using the this.document interface methods and
properties) is called Document Object Model (DOM).
2 Document Object Model (DOM) may be visualized as shown
in Fig.66.
No. Section Cyber crime Max. Imprisonment Max. Fine Both imp’ a
1 65 Tampering with computer source documents
2 years 2Lakh Yes
2 66 Hacking
3 years 5Lakh Yes
3 66B Receiving stolen computer/ mobile
3 years 1Lakh Yes
4 66C Misuse of password
3 years 1Lakh Yes
5 66D Cheating with computer
3 years 1Lakh Yes
6 66E Publishing private images of others
3 years 2Lakh Yes
7 66F Cyber terrorism
Life − No
8 67 Publishing obscene content
5 years 1Lakh Yes
9 67A Publishing sexual content
7 years 1Lakh Yes
1Lakh;
10 67B Publishing child porn 5; 7 years
1Lakh
(subse- Yes
(subse-
quent)
quent)
11 67C Failure to maintain records by operator
3 years undefined Yes
12 68 Failure to comply with orders
3 years 2Lakh Yes
Syllabus
Benefits of cloud services, different categories. Resources
available in cloud. Identify Phases of the Application
Development Life Cycle. Describe Roles in each of phases of
the Application Development Life Cycle.
Cloud computing
▶ Cloud computing means storage and processing of data on
remote computers connected through the Intenet.
▶ Thin clients like Chromebooks can store data and run
programs in the remote cloud.
▶ Cloud services are offered by several companies, including
Microsoft, IBM, Apple Computer, Google, DropBox, etc.
Categories of cloud services
▶ Private clouds: Private clouds are services maintained by
large firms for their internal usage.
▶ Public clouds: Public cloud services are accessed over the
common Internet. The services may be paid or free.
OneDrive, iCloud, Google Drive, DropBox, etc. are examples
of public cloud.
▶ Hybrid clouds: Hybrid clouds provide some public services
accessible to everyone and some restricted services accessible
for internal use of employees.
▶ Community clouds: Some individuals or organizations having
common interests may share data and storage on a cloud. For
persons or organizations outside the particular community, the
cloud looks like a private cloud.
Resources available on cloud
▶ Data storage: Photos and documents may be uploaded to
cloud server and accessed from any device.
▶ SaaS: Software as a Service (SaaS) provides for access to
software from any connected device. This has created annual
subscription and renewal model for software packages.
▶ IaaS: Infrastructure as a Service (IaaS) provides access to
state of the art IT infrastructure through cloud computers.
Amazon Web Services (AWS), Google Cloud, IBM Cloud and
Microsoft Azure are some of the IaaS services for enterprises.
▶ PaaS: Certain program development projects might require
specific platforms, which may be costly to acquire. PaaS
(Platform as a Service) provides complete development
platform for specific duration on rental over the Internet.
Application Development Lifecycle
▶ Application development begins with the assessment of
customer demand, passes through planning, development and
testing.
▶ After testing, the software may be deployed.
▶ Deplyoment brings new bugs to light.
▶ Bug fixing and maintenance are the next phases in software
development lifecycle.
▶ Some software packages might require minor improvements or
complete revamping. New releases of the software should be
brought out to address such needs.
Application Development Lifecycle
https://in.pinterest.com/pin/48554502225799381/?nic v3=1a5RdrJA
https://blogs.windows.com/windowsexperience/2021/06/24/introduc
windows-11/
https://www.plus2net.com/php tutorial/pdf-data-student.php
https://oracletutes.com/rdbms-relational-database-
management-system/
https://www.javatpoint.com/data-models
https://www.supraits.com/oracle-practice/oracle-application-
services/dba-services/
http://www.tutorialspoint.com/computer fundamentals/computer th
https://en.wikipedia.org/wiki/Cloud computing#/media/File:Cloud c
https://blog.hostonnet.com/wp-
content/uploads/2014/08/Keyboard-White-on-Black.jpg
http://llg.cubic.org/docs/mouse.jpg
https://upload.wikimedia.org/wikipedia/commons/e/e3/Scanner.view
http://cdn.makeuseof.com/wp-
content/uploads/2012/03/bambooconnect.png?b34c28
https://upload.wikimedia.org/wikipedia/commons/c/cd/HypertextEd
https://mrcenet.files.wordpress.com/2011/12/color monitor.jpg
http://static2.shop.indiatimes.com/images/products/additional/origin
tft/dell-tft-23-inch-monitor-s2330mx.jpg
http://images17.newegg.com/is/image/newegg/24-112-024-
TS?$S300$
http://us.aoc.com/images/monitors/E2476VWM6/large/E2476VWM
front.png
http://n3.sdlcdn.com/imgs/a/o/a/TVS-Electronics-MSP-430-
Printer-SDL209857912-1-7176b.jpg
http://s7.computerhistory.org/is/image/CHM/102630084p-
03-01?$re-zoomed$
http://common.ziffdavisinternet.com/encyclopedia images/CHAINPT
https://upload.wikimedia.org/wikipedia/commons/5/52/IBM Selectr
http://www.jeffdwoskin.com/printers/img/character/daisywheel.jpg
http://static.electronicsweekly.com/news/wp-
content/uploads/sites/16/2015/04/01apr15LumeJet-v-
Inkjet.jpg
http://www.explainthatstuff.com/laserprinters.html
http://www.solopress.com/blog/wp-
content/uploads/2013/03/direct-thermal-printing-graphic.jpg
http://cdn2.hubspot.net/hub/108303/file-16282842-
jpg/images/c–users-stef-documents-front burner-front burner-
great lakes blog-plotter print-resized-600.jpg
http://images.pcworld.com/news/graphics/146957-8086-
chip b.jpg
http://www.us-trading-
center.com/assets/img/recycling/cpus/386-486Individual.jpg
http://www.activewin.com/reviews/hardware/processors/intel/p422g
http://www.pcstats.com/articleimages/200703/c2de6600 frntrear.jpg
http://innoreviews.com/wp-content/uploads/2016/03/I3-
3220.jpg
http://innoreviews.com/wp-content/uploads/2016/03/I3-
3220.jpg
http://techgage.com/wp-content/uploads/2013/12/Intel-
Core-i7-Haswell-500x362.jpg
http://www.amd.com/PublishingImages/photography/product/360px
opteron-4000.png
http://ebay.18004memory.com/ebaypics/SDRAM/PC133/DIMM/232
OX1.gif
https://upload.wikimedia.org/wikipedia/en/thumb/d/d3/Samsung di
Samsung displays first DDR4 module.jpg
http://www.informationq.com/wp-
content/uploads/2012/10/computer-Motherboard.jpg
http://s.hswstatic.com/gif/adding-a-hard-disk-1-1.jpg
http://www.zeppelincomputers.com/data/products/id1162/web tosh
https://upload.wikimedia.org/wikipedia/commons/7/7e/Floppy disk
https://images-eu.ssl-images-
amazon.com/images/I/41pS7kV8G2L.jpg
https://napa.i.lithium.com/t5/image/serverpage/image-
id/30360i84422B7A2F74F977?v=v2
http://ecx.images-amazon.com/images/I/41Yh-ta6tUL.jpg
http://stevensoncaitlin.typepad.com/.a/6a015434c258c3970c0162fd2
pi
https://en.wikipedia.org/wiki/Windows 10 Mobile#/media/File:Wind
http://allthingsd.com/files/2012/09/FXOS IconGrid.jpg
https://upload.wikimedia.org/wikipedia/commons/a/a1/Tizen screen
https://technet.microsoft.com/en-us/library/cc940018.aspx
http://networking.layer-x.com/p020000-1.html
http://computernetworkingsimplified.in/physical-layer/typical-
hardware-components-physical-layer-2/
https://btsadvancedcommunications.files.wordpress.com/2011/11/stp
https://fcit.usf.edu/network/chap4/pics/coaxial.gif
https://fcit.usf.edu/network/chap4/pics/fiberop.gif
https://www.techpluto.com/wp-
content/uploads/2009/10/tutorial-osi-7-layer-model.gif
http://cdn.ttgtmedia.com/rms/onlineImages/networking-
osi vs tcp-ip model table desktop.jpg
https://www.ibm.com/docs/en/zos-basic-skills?topic=zos-
application-development-life-cycle-overview
https://www.w3schools.com/js/js htmldom.asp
https://www.javatpoint.com/document-object-model
https://en.wikipedia.org/wiki/Visual Basic for Applications