Wednesday, July 24, 2019

How we Change Colour and Size of text in JavaScript

Change Colour and Size of text



CODE

change.html

<html>
<head>
<title> Change Color</title>
<script>
function ChangeColor(){
var x = document.getElementById('changecolor');
x.style.fontSize="25px";
x.style.color="red";
}

</script>
</head>
<body>
<p id="changecolor"> WELCOME</p>
<button type="button" onclick="ChangeColor()">Change</button>

</body
</html>
Try it Yourself »




OUTPUT



Change Color
WELCOME



How we add two number in JavaScript

add.html
<html>
<head>
<title>Click </title>
<script>
function myfunction(){
document.getElementById('add')
.innerHTML=2+3;
}
</script>
</head>
<body>
<p id="add">2+3</p>
<button type="button" onclick="myfunction()">ADD</button>

</table>
</body>
Run example »
  

OUTPUT

Click
2+3



Tuesday, July 23, 2019

cs201 Solved Pass Paper

What is function of cout ?
 (a) To send data to printer
 (b) To read data from keyboard
(c) To display message
(d) To display output on the screen 

In Flow chart process is represented by
 (a) Rectangle 
(b) Arrow symbol
(c) Oval
(d) Circle

&& is -------------------- operator.
 (a) An arithmetic
 (b) Logical
 (c) Relational
l(d) Unary

An over Flow condition occurs when we try to assign a value to a variable which is,
 (a) Less than its maximum size
 (b) Greater than its maximum size
 (c) With in its range
(d) Equal to its size

Which of the following data type(s) can operate on modulus operator ‘%’?
 (a) float, int
 (b) float, double
 (c) int
 (d) char

Which of the following is the correct way to declare a variable x of integer type?
 (a) x int ;
(b) integer x ;
 (c) int x; 
(d) x integer

What will be the range of numbers generated by function rand () % 9?
 (a) 0 to 9
(b) 1 to 9
(c) 0 to 8 
(d) 1 to 8

What will be the correct syntax to declare two-dimensional array of float data type?
 (a) float arr{2}{2} ;
 (b) float arr[2][2] ; 
(c) float arr[2,2] ;
(d) float[2][2] arr

In while loop the loop counter must be initialized,
 (a) With in the loop
 (b) Before entering the loop 
(c) At the end of the loop
 (d) None of the given options

There is a pointer variable named ptr of type int then address of which type of variable the ptr will store in it?
 (a) variable of type char
(b) variable of type short
 (c) variable of type int
 (d) variable of type double

 Suppose int multi[5][10]; when we are using **multi , it means,
 (a) Single dereferencing
(b) Single referencing
(c) Double referencing
 (d) Double dereferencing

The precedence of * is higher than dot operator (.)operator
(a) True 
(b) False

When a call to function statement is encountered,
 (a) The control transfers to its Prototype 
(b) The control transfers to its definition
 (c) Control returns to statement following function call
(d) The compiler stops execution of whole program

 A function must always return value.
(a) True 
(b) False




What is the output of the following statement? 
 int i = 2.5; do { cout i * 2; } while (i > 3 && i < 10);
 (a) 510
 (b) 5
(c) 48
 (d) error

What does !(7) evaluate to in decimal where ! is a NOT operator?
 (a) 7
(b) 8
(c) 9 (
d) 10

The condition in while loop may contain logical expression but not relational expression.
 (a) True
(b) False

Searching is easier when an array is already sorted 
(a) True (
b) False

If an array has 100 elements, what is allowable range of subscripts?
 (a) 0 - 99
(b) 1 - 99
 (c) 0 - 100
 (d) 1 - 100

Which of the following function returns the size of a string variable? 
(a) strlength()
 (b) stringlen()
 (c) strlen() 
(d) strLength()

What will be the range of numbers generated by function rand () % 9?
(a) 0 to 9
(b) 1 to 9
 (c) 0 to 8
(d) 1 to 8

Computer can understand only machine language code.
 (c) True 
(d) False

Which of the following header file include string conversion functions? 
(a) string.h 
(b) stdlib.h
(c) ctype.h
(d) sconvert.h

The function of cin is 
(a) To display message
(b) To read data from keyboard 
(c) To display output on the screen
 (d) To send data to printer

How many parameter(s) function getline() takes?
 (a) 0
 (b) 1
 (c) 2 
(d) 3

Word processor is 
(a) Operating system
(b) Application software
 (c) Device driver
(d) Utility software

Each pass through a loop is called a/an 
(a) enumeration
(b) Iteration 
(c) culmination
(d) pass through

A continue statement causes execution to skip to 
(a) the return 0; statement 
(b) the first statement after the loop
(c) the statements following the continue statement
(d) the next iteration of the loop

What is the correct syntax to declare an array of size 10 of int data type? 
(a) int [10] name ;
 (b) name[10] int ; 
(c) int name[10] ;

What will be the correct syntax to initialize all elements of two-dimensional array to value 0?
 (a) int arr[2][3] = {0,0} ;
 (b) int arr[2][3] = {{0},{0}} ;
(c) int arr[2][3] = {0},{0} ;
(d) int arr[2][3] = {0} ;

How many bytes will the pointer intPtr of type int move in the following statement? intPtr += 3 ;
 (a) 3 bytes
(b) 6 bytes
 (c) 12 bytes
 (d) 24 bytes

If there are 2(n+1) elements in an array then what would be the number of iterations required to search a number using binary search algorithm? 
(a) n elements
(b) n+1) elements
(c) 2(n+1) elements
 (d) 2 (n+1) elements

Which of the following operator is used to access the value of variable pointed to by a pointer?
 (a) * operator
 (b) -> operator
(c) && operator
 (d) & operator

The ________ statement interrupts the flow of control. 
(a) switch
 (b) continue
 (c) goto
(d) break

Analysis is the -------------- step in designing a program 
(a) Last
(b) Middle
 (c) Post Design
(d) First 

Paying attention to detail in designing a program is _________
(a) Time consuming
(b) Redundant
(c) Necessary
 (d) Somewhat Good

The while loop becomes infinite,
 (a) When the condition is always false
(b) . When the condition is less than zero
 (c) When the condition is always true 
(d) When the condition contains a logical operator

If we want to store a string “abc” in an array str then the size of this array must be at least,
(a) 2
(b) 3 
(c) 4
(d) 5

No executable code will be generated if error is found during translation of the program using interpreter. 
(a) True
 (b) False

Word processor is 
(a) Operating system
(b) Application software
 (c) Device driver
(d) Utility software

Which of the following is correct way to initialize a variable x of int type with value 10?
 (a) int x ; x = 10 ;
 (b) int x = 10 ; 
(c) int x, x = 10;
(d) x = 10 ;

If there is more than one statement in the block of a for loop, which of the following must be placed at the beginning and the ending of the loop block?
 (a) parentheses ( )
 (b) braces { }
(c) brackets [ ] 
(d) arrows < >

Name of an array is a constant pointer.
 (a) True
 (b) False

Loader loads the executable code from hard disk to main memory. 
(a) True
 (b) False

Which of the follwoing values C++ use to represent true and false?
 (a) 1 and 0 
(b) 1 and -1
(c) 11 and 00
(d) Any numerical value

 The argument of the isdigit() function is ___________________
 (a) a character,
 (b) a C-string,
(c) a C++ string class variable
(d) None of the given options.

A precise sequence of steps to solve a problem is called 
  Statement
  Program
Utility
Routine

The Compiler of C language is written in 
  Java Language
  UNIX
  FORTRON Language
  C Language 

In if structure the block of statements is executed only, 
  When the condition is false
  When it contain arithmetic operators
  When it contain logical operators
  When the condition is true 

Which of the following function(s) is/are included in stdlib.h header file?
  double atof(const char *nptr)
  int atoi(const char *nptr)
  char *strcpy ( char *s1, const char *s2)
  1 and 2 only

Dealing with structures and functions passing by reference is the most economical method
  True 
  False

Pointer is a variable which store,
  Data
  Memory Address
  Data Type
  Values

Which of the following can not be a variable name? 
area
  _area
  10area
  area2

Which of the following header file defines the rand() function?
  iostream.h
  conio.h
  stdlib.h 
  stdio.h
In C/C++ the string constant is enclosed 
(a) In curly braces
 (b) In small braces
 (c) In single quotes 
(d) In double quotes

In flow chart, the symbol used for decision making is,
 a) Rectangle
b) Circle
c) Arrow
d) Diamond

 The data type before a function name represents its, 
(a) Return Type
 (b) Function data
(c) Function arguments
 (d) Function name

The operator used to take the address of a variable is,
 (a) &&
 (b) ++
(c) –
 (d) & 

The header file which is used for input and output is
 (a) maths.h
(b) string.h
 (c) iostream.h 
(d) ctype.h

When we are using command line argument(s), the default argument in C/C++ is/are ____________ . a) argc
 b) argd
c) argv
d) argc and argv 

In C++, Integer calculation occurs in _____ bytes.
a) 1 byte
b) 2 bytes 
c) 4 bytes
d) 8 bytes

In the declaration of two dimensional array,
(a) First index represents row and second represents column
 (b) First index represents column and second represents row
 (c) Both indexes represent rows
 (d) Both indexes represent column

The address operator (&) can be used with,
a) Statement
 b) Expression
c) Variable 
d) Constant

Which character is inserted at the end of string to indicate the end of string?
 a) new line
 b) tab
c) null 
d) carriage return

Syntax of union is identical to ______
a) Structure 
b) Class
 c) Function
 d) None of the given options



Which programming tool is helpful in tracing the logical errors?
 Solution:Debugger tool is helpful in tracing the logical errors.

Why should goto statement be avoided in C/C++?
 When structured programming was started, it was urged not to use the goto statement. Though goto is there in C language but we will not use it in our programs. It will adopt the structured approach. All of our programs will consist of sequences, decisions and loop. Because loop provide best platform to manipulate the data.

What is a truth Table?
 Solution:- We know the concept of truth table. The truth tables are very important. These are still a tool available for analyzing logical expressions. We will read logic design in future, which is actually to do with chips and gate. We find it difficult to evaluate a complicated logical expression. Sometimes the logic becomes extremely complicated so that even writing it as a simple syntax statement in any language.

 What are similarities and differences between Structures and Unions?
In structures, we have different data members and all of these have their own memory space. In union, the memory location is same while the first data member is one name for that memory location. However, the 2nd data member is another name for the same location and so on. Consider the above union (i.e. intOrChar) that contains an integer and a character as data members. What will be the size of this union? The answer is the very simple. The union will be allocated the memory equal to that of the largest size data member. If the int occupies four bytes on our system and char occupies one byte, the union intOrChar will occupy four bytes

What is a Linker?
 (3) Linker Most of the time our program is using different routines and functions that are located in different files, hence it needs the executable code of those routines/functions. Linker is a tool which performs this job, it checks our program and includes all those routines or functions which we are using in our program to make a standalone executable code and this process is called Linking




Cs201 Viva Qestion

What is constructor ? 
Ans: initialize data members to memory. 
What is destructor ? 
Ans: remove data members from memory
. What is Assignment Operator ? 
Ans: Equal sign used for assignment operator.
 What is switch statement ? 
Ans: Select one option from many options. 
What is Array ? 
Ans: Store more than one variables for same data types.
 What is Abstraction ?
 Ans: Enhancing program capabilities. 
What is Encapsulation ? 
Ans: hiding implementation from outside the world. 
How many data types ? 
Ans: Four 
Tell the name of data types ? 
Ans: Int, Float, Char, String 
What is difference between while loop and do while loop ? 
Ans: while loop check condition first, do-while loop first execute statement then check condition. 
Pre-processor Directories Why we Use variable? 
What is compiler and translator ? 
Syntax of arrays? 
why use pointer? 
difference b/w for and while loop?
 types of arrays? infinite loop? 
difference b/w c & C++/? define class? 
Difference b/w Static and Dynamic memory Contractors & Destruction Friend Function what is variable?
 what is compiler and translater? 
Syntax of arrays? why use pointer?
 differenc b/w for and while loop? 
types of arrays?
infinite loop? 
difference b/w c & C++/?
 define class?

PPSC Jobs Advertisement No 23/2019 - PPSC Junior Clerk Jobs

In today newspaper  has found latest advertisement of Punjab Public Service Commission PPSC Jobs 2019 announced by Government of Punjab in Services And General Administration Department.
Eligible candidates are encouraged to apply to the post in prescribed manner. Only shortlisted candidates will be called for written test/interview.Incomplete, late, submissions/applications will not be entertained.


Title
Details
Total Vacancies 
112
Published Date
22 July 2019
Last Date to Apply
5 August 2019
Department
Services And General Administration Department 
City
Multiple 
Category
Government






Vacancies / Positions:

Department brought the recent advertisement of Latest Jobs for which it is once again looking to hire the educated, experienced, energetic and well disciplined applicant for the following positions:
  • Librarian
  • Project Manager
  • Junior Clerk



How To Apply for PPSC Junior Clerk Jobs:

Apply Online at PPSC.GOP.PK
All Details are Given in the Advertisement , Please Download the Job Advertisement From Below , Read the Details Carefully and Apply for The Job according to Your Qualification and Skills .

CS 302 Assignment 3 2019 with Solution File





To get Solution file comment below ur mail.

Monday, July 22, 2019

HTML5 Server-Sent Events

Example

<script>
if(typeof(EventSource) !== "undefined") {
  var source = new EventSource("demo_sse.php");
  source.onmessage = function(event) {
    document.getElementById("result").innerHTML += event.data + "<br>";
  };
} else {
  document.getElementById("result").innerHTML = "Sorry, your browser does not support server-sent events...";
}
</script>

</body>
</html>

Try it Yourself »


HTML5 Web Workers

Example

<!DOCTYPE html>
<html>
<body>

<p>Count numbers: <output id="result"></output></p>
<button onclick="startWorker()">Start Worker</button>
<button onclick="stopWorker()">Stop Worker</button>

<script>
var w;

function startWorker() {
  if (typeof(Worker) !== "undefined") {
    if (typeof(w) == "undefined") {
      w = new Worker("demo_workers.js");
    }
    w.onmessage = function(event) {
      document.getElementById("result").innerHTML = event.data;
    };
  } else {
    document.getElementById("result").innerHTML = "Sorry! No Web Worker support.";
  }
}

function stopWorker() 
  w.terminate();
  w = undefined;
}
</script>

</body>
</html>
Try it Yourself »

OUTPUT

Example Count numbers:

HTML5 Web Storage

Example

<!DOCTYPE html>
<html>
<head>
<script>
function clickCounter() {
  if (typeof(Storage) !== "undefined") {
    if (sessionStorage.clickcount) {
      sessionStorage.clickcount = Number(sessionStorage.clickcount)+1;
    } else {
      sessionStorage.clickcount = 1;
    }
    document.getElementById("result").innerHTML = "You have clicked the button " + sessionStorage.clickcount + " time(s) in this session.";
  } else {
    document.getElementById("result").innerHTML = "Sorry, your browser does not support web storage...";
  }
}
</script>
</head>
<body>

<p><button onclick="clickCounter()" type="button">Click me!</button></p>
<div id="result"></div>
<p>Click the button to see the counter increase.</p>
<p>Close the browser tab (or window), and try again, and the counter is reset.</p>

</body>
</html>
Try it Yourself »

OUTPUT


Click the button to see the counter increase.
Close the browser tab (or window), and try again, and the counter is reset.

HTML5 Drag and Drop

Example

<!DOCTYPE HTML>
<html>
<head>
<script>
function allowDrop(ev) {
  ev.preventDefault();
}

function drag(ev) {
  ev.dataTransfer.setData("text", ev.target.id);
}

function drop(ev) {
  ev.preventDefault();
  var data = ev.dataTransfer.getData("text");
  ev.target.appendChild(document.getElementById(data));
}
</script>
</head>
<body>

<div id="div1" ondrop="drop(event)" ondragover="allowDrop(event)"></div>

<img id="drag1" src="img_logo.gif" draggable="true" ondragstart="drag(event)"width="336" height="69">

</body>
</html>
Try it Yourself »

Sunday, July 21, 2019

CS401 assignment no 3 Complete Solution

  • HTML

  • Code

    [org 0x0100]

    jmp start


    oldisr: dd 0 ; space for saving old isr

    ; keyboard interrupt service routine

    kbisr:

    push ax

    push es

    mov ax, 0xb800

    mov es, ax ; point es to video memory

    in al, 0x60 ; read a character from keyboard port

    cmp al, 0x11 ; has the 'w' key pressed

    jne nomatch ; no, go to nomatch

    mov byte [es:0], '1' ; yes, print 1

    mov byte [es:2], '5' ; yes print 0

    jmp exit ; leave interrupt routine

    nomatch:

    pop es

    pop ax

    jmp far [cs:oldisr] ; call the original ISR

    exit

    mov al, 0x20

    out 0x20, al ; sent EOI to PIC

    pop es

    pop ax

    iret ; return from interrupt

    start:

    xor ax, ax

    mov es, ax ; point es to IVT base

    mov ax, [es:9*4]

    mov [oldisr], ax ; save offset of old routine

    mov ax, [es:9*4+2]

    mov [oldisr+2], ax ; save segment of old routine

    cli ; disable interrupts

    mov word [es:9*4], kbisr ; store offset at n*4

    mov [es:9*4+2], cs ; store segment at n*4+2

    sti ; enable interrupt

    mov dx, start ; end of resident portion

    add dx, 15 ; round up to next para

    mov cl, 4

    shr dx, cl ; number of paras

    mov ax, 0x3100 ; terminate and stay residant

    int 0x21
    Try it Yourself »