Sunday 1 November 2020

What is Information Security?

Information Security is not only about securing information from unauthorized access. Information Security is basically the practice of preventing unauthorized access, use, disclosure, disruption, modification, inspection, recording or destruction of information. Information can be physical or electronic one. 


Monday 26 October 2020

Write a PHP program to store user registration information (like user name, address, DOB, age, Aadhar card number, gender) with data base and display that details on view screen in tabular manner

user.html 

<html>

<head>

<title> user registration information</title>

</head>

<body>

<h3 align="center">user registration information</h3>

<form name="registration" method="post" action="storeuser.php">

<table align="center" height="450">

<tr>

<td>Name:</td>

<td><input type="text" name="name" id="name" /></td>

</tr>

<tr>

<td>Address:</td>

<td><textarea rows="4" cols="30" name="address" id="address"></textarea>  </td>

</tr>

<tr>

<td>Date of Birth:</td><td><input type="date" name="dob" id="dob"/></td>

</tr>

<tr>

<td>Age:</td>

<td><input type="number" name="age" id="age" /></td>

</tr>

<tr>

<td>Aadhar Number:</td>

<td><input type="text" name="aadhar" id="aadhar" /></td>

</tr>

<tr>

<td>Gender:</td>

<td><input type="radio" name="gender" value="male" /> Male

<input type="radio" name="gender" value="female" /> Female</td>

</tr>

<tr>

<td colspan="2" align="center">

<input value="Submit" type="submit"/>

<input value="reset" type="reset" />

</td>

</tr>

</table>

</body>

</html>



storeuser.php

<?php

$link = mysqli_connect("localhost", "root", "", "wit");

// Check connection

if($link === false){

    die("ERROR: Could not connect. " . mysqli_connect_error());

}

// Escape user inputs for security

$user = mysqli_real_escape_string($link, $_POST['name']);

$address = mysqli_real_escape_string($link, $_POST['address']);

$dob = mysqli_real_escape_string($link, $_POST['dob']);

$age = mysqli_real_escape_string($link, $_POST['age']);

$aadhar = mysqli_real_escape_string($link, $_POST['aadhar']);

$gender = mysqli_real_escape_string($link, $_POST['gender']);

// attempt insert query execution

$sql = "INSERT INTO storeuser (name, address,dob,age,aadhar,gender) VALUES ('$user', '$address',

'$dob','$age','$aadhar','$gender')";

if(mysqli_query($link, $sql)){

    echo "Records added successfully.";

$link_address="store.html";

echo "<a href='".$link_address."'>Go to Register Page</a>";

} else{

    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);

}

// close connection

mysqli_close($link);

?>

<a href="display.php">|Display|</a>

display.php

<html>

<body>

<?php

mysql_connect("localhost","root","");

mysql_select_db("wit");

$r=mysql_query("select * from storeuser");

echo"<table border=1>";

echo"<tr><th>User Name</th><th>Address</th><th>Date of Birth</th><th>Age</th><th>Aadhar Number</th><th>Gender</th></tr>";


while ($row=mysql_fetch_array($r))

{        echo"<tr>";

      echo "<td>".$row['0']."</td>"."<td>".$row['1']."</td>"."<td>".$row['2']."</td>"."<td>".$row['3']."</td>"."<td>".$row['4']."</td>"."<td>".$row['5']."</td>";

        echo "</tr>";

}

echo"</table>";

?>

<a href="store.html">|Home|</a>

</body>

</html>



Monday 19 October 2020

Write a script that asks the user to enter two numbers and outputs text that displays the sum, product, difference and quotient of the two numbers.

 <html>

<head>

<title>javascript using sum, product, difference and quotient</title>

<script>

     var number1; 

     var number2; 

     var sum; 

     var product; 

     var difference; 

     var quotient;

     number1 = parseInt(window.prompt( "Enter first number" ));

     number2 = parseInt(window.prompt( "Enter second number" ));

     sum = number1 + number2; 

     product = number1 * number2; 

     difference = number1 - number2; 

     quotient = number1 / number2;

document.writeln( "<h3>The sum is " + sum + "</h3>" );

document.writeln( "<h3>The product is " + product + "<h3>");

document.writeln( "<h3>The difference is " + difference + "<h3>");

document.writeln( "<h3>The quotient is " + quotient + "<h3>");

</script></head>

</html>

Output:



Sunday 18 October 2020

Design a form using HTML and java script to collect the details from the user such as name, gender (radio button), address, state & city. Create a dynamic drop down list for state and based on state, create another drop down list containing list of cities for that state.

 <html>

<head><title>dynamic drop down list</title>

<script>

function dropdownlist()

{

var state=document.getElementById('input').value;

if(state==="AP")

{

var array=["Tirupati","vizag","kadapa","Amaravathi","kurnool"];

}

else if(state==="KA")

{

var array=["Bangalore","Mysore","Mangalore","Hubli"];

}

else if(state==="TN")

{

var array=["vellore","chennai","Coimbatore","Madurai"];

}

else if(state==="TG")

{

var array=["Hyderabad","Warangal","Nizamabad","Karimnagar"];

}

else

{

var array=[];   

}

var string='';

for(i=0;i<array.length;i++)

{

string=string+"<option>"+array[i]+"</option>";

}

string="<select name='loc'>"+string+"</select>";

document.getElementById('output').innerHTML=string;

}

</script></head>

<body>

<form name="collectdetails">

<p>Name:<input type="text" name="uname" id="uname" /></p>

<p>Gender:<input type="radio" name="gender" value="male">Male

<input type="radio" name="gender" value="female">Female</p>

<p>Address:<textarea rows="4" cols="10" placeholder="please enter the proper address"></textarea></p>

<p>

State:

<select id="input" onChange='dropdownlist()'>

<option>select</option>

<option>AP</option>

<option>TG</option>

<option>TN</option>

<option>KA</option>

</select>

</p>

City:

<div id="output">

<select>

<option>select</option>

</select>

</div></form></body>

</html>

Output:



Write a script that reads an integer and determines whether it is arm strong number or not.

     <html><head><title>Armstrong number or not</title>

    <script>

function Armstrong()

{

var flag,number,remainder,addition = 0;

number = Number(document.getElementById("num").value);

flag = number;

while(number > 0)

{

remainder = number%10;

addition = addition + remainder*remainder*remainder;

number = parseInt(number/10);

}

if(addition == flag)

{

window.alert("The input number is Armstrong");

}

else

{

window.alert("The input number is not Armstrong");

}

}

    </script></head>

<body>

<h1>Whether a number is Armstrong or not</h1>

    Enter the number :<input type="text" name="n" id = "num"/><br/>

<input type="submit" value="CHECK" onClick="Armstrong()" />

</body>

    </html>

For example Armstrong numbers are : 153    370     371     407

Output: 




Write a PHP script to sort the elements in descending order of an array.

 Example 1

<?php 

$numbers = array(20, 91, 4, 39, 23); 

rsort($numbers); 

$arraylength = count($numbers); 

for($x = 0; $x < $arraylength; $x++) { 

    echo $numbers[$x]; 

    echo "<br>"; 

?> 

Output: 

91

39        

23        

20        

4

Example 2

<?php

$cars = array("Maruthi", "TATA", "KIA");

rsort($cars);

$carslength = count($cars);

for($i = 0; $i < $carslength; $i++) {

  echo $cars[$i];

  echo "<br>";

}

?>

Output: 

TATA
Maruthi
KIA

Example 3

<?php

// Define array

$numbers = array(1,2,3,4,5,6,7,8,9,10);

// Sorting and printing array

rsort($numbers); // rsort- sort arrays in descending order

print_r($numbers);

?>

Output: 

Array ( [0] => 10 [1] => 9 [2] => 8 [3] => 7 [4] => 6 [5] => 5 [6] => 4 [7] => 3 [8] => 2 [9] => 1 )

Example 4

<?php

$colors = array("Red", "Blue", "Green","Yellow");

rsort($colors);

print_r($colors);

?>

Output: Array ( [0] => Yellow [1] => Red [2] => Green [3] => Blue )



Write a PHP program that receives the value of N using HTML form and displays the first N Fibonacci numbers as HTML list.

  <?php

function Fibonacci($num){ 

if ($num == 0) 

return 0;     

else if ($num == 1) 

return 1;     

else

return (Fibonacci($num-1) +  Fibonacci($num-2)); 

?>

<html>

<head><title>Fibonacci example</title></head>

<body><form action="" method="POST">

Enter Number:<input type="text" name="num"/><br/><br/>

<input type="submit" name="print" value="Print N Fibonacci Numbers"/>

</form>

<?php   

if(isset($_POST["print"]))

{

$num = $_POST["num"]; 

for ($counter = 0; $counter < $num; $counter++){   

echo "  ".Fibonacci($counter)."  "; 

}

}

?>

</body></html>


Thursday 15 October 2020

Web and Internet Technologies 2 Marks questions and answers

 1. What are the different types of lists in HTML?

Ans. unordered list <ul>

        ordered list <ol>

        Nested list - combination of unordered list and ordered list.

        description list - <dl>

2. What is the purpose of meta tags in HTML?

Ans. The <meta> tag defines metadata about an HTML document.

<meta> tags always go inside the <head> element, and are typically used to specify character set, page description, keywords, author of the document, and viewport settings.

3. What are the different types of  Cascading Style Sheets?

Ans. There are three ways of inserting a style sheet are

                    1. Inline CSS

                    2. Internal / embedded CSS

                    3. External CSS

4. What are HTML5 added several new input types?

Ans.

    1. color                   <input type="color">
    2. date                    <input type="date">
    3. datetime-local    <input type="datetime-local">
    4. email                 <input type="email">
    5. month
    6. number
    7. range
    8. search
    9. tel
    10. time
    11. url
    12. week
5. What is DTD and types of DTD's?
Ans. A Document Type Definition defines the structure and the legal elements and attributes of an XML document. Two types of DTD's are 

                                    1. Internal DTD

                                    2. External DTD

6. What are PHP super global variables?

Ans.  The PHP superglobal variables are:

                                    $GLOBALS

                                    $_SERVER

                                    $_REQUEST

                                    $_POST

                                    $_GET

                                    $_FILES

                                    $_ENV

                                    $_COOKIE

                                    $_SESSION

7. What is AJAX?

Ajax stands for Asynchronous JavaScript And XML.

AJAX is not a programming language.

It is a technique for creating better, faster and more interactive web applications with the help of XML, DOM,HTML , CSS and JavaScript.

Unlike classic web pages , which must load in their entirety if content changes.

AJAX allows web pages to be updated asynchronously by fetching data from the server behind the scenes.

AJAX cannot work independently.

AJAX uses a combination of:

        1. HTML and CSS for presentation.

        2. DOM for dynamic display of and interaction with data.

        3. JSON (JavaScript Object Notation)or XML for the interchange of data, and XSLT for its                        manipulation.

        4. XMLHttpRequest object (to exchange data asynchronously with a server)

        5. JavaScript.

8. What is Asynchronous in AJAX?

 Ans. Asynchronous means that we are exchanging data to/from the server in the background without having to refresh the page.

9. What about the response in AJAX Application?

Responses from the server in AJAX are handled in the form of callbacks.

A callback is a special function which is used in AJAX so that server can respond to the client when it is ready to send data to the client.

10. What are Advantages of AJAX?

AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

Bandwidth Usage- Ajax based application use less server bandwidth, because no need to reload complete page.

Asynchronous calls- AJAX make asynchronous calls to a web server. This means client browsers are avoid waiting for all data arrive before start the rendering.

XMLHttpRequest - XMLHttpRequest has an important role in the Ajax web development technique. XMLHttpRequest is special JavaScript object that was designed by Microsoft. XMLHttpRequest object call as a asynchronous HTTP request to the Server for transferring data both side.

11. What are Disadvantages of AJAX?

View source is allowed and anyone can view the code source written for AJAX.

       It can increase design and development time.

       More complex than building classic web application.

       Search Engine like Google cannot index AJAX pages.

       JavaScript disabled browsers cannot use the application.

       Security is less in AJAX application. Anyone can view the source code written for Ajax.

       The back button problem. People think that when they press back button, they will return to the last change they made, but in AJAX this doesn't hold.

12. What is XMLHttpRequest object ?

The XMLHttpRequest object can be used to exchange data with a server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

13. What are XML Schema built-in data types?


Primitive data types:

String, boolean, decimal, float, double, duration,dateTime, time, date, gYearMonth, gYear, gDay,

gMonthDay, gMonth, hexbinary, base64binary, anyURL, QName, NOTATION.

Derived  data types:

normalizedString, token,language,NMTOKEN,NMTOKENS,Name, NCName, ID, IDREF, IDREFS, ENTITY,ENTITIES,integer, nonPostiveInteger, PostiveInteger,NegativeInteger, nonNegativeInteger, unsignedLong,unsignedInt, unsignedShort, unsignedByte,long, int, short, byte.

14. Types of XSD Elements?

Simple Elements

Complex Elements

15. What are Building Blocks of XML Documents?

Seen from a DTD point of view, all XML documents are made up by the following building blocks:

                    1. Elements

                    2. Attributes

                    3. Entities

                    4. PCDATA

                      5. CDATA

16. What are XML Schema (XSD) Indicators?

We can control HOW elements are to be used in documents with indicators.

                        1. <all>

                        2. <choice>

                        3. <sequence>

17. Difference between Document Type Definition(DTD) and XML Schema Definition(XSD)?


18. What is XML Schema?

An XML Schema describes the structure of an XML document.

The XML Schema language is also referred to as XML Schema Definition (XSD).

The purpose of an XML Schema is to define the legal building blocks of an XML document:

XML Schema is an XML-based alternative to DTD.

19. What is PCDATA and CDATA?

PCDATA

PCDATA means parsed character data.

Text found between the start tag and the end tag of an XML element.

PCDATA is text that WILL be parsed by a parser. The text will be examined by the parser for entities and markup.

Example

employee.dtd

<!ELEMENT employee (firstname,lastname)>  

<!ELEMENT firstname (#PCDATA)>  

<!ELEMENT lastname (#PCDATA)>  

employee.xml

<?xml version="1.0"?> 

<!DOCTYPE employee SYSTEM "employee.dtd"> 

<employee> 

  <firstname>virat </firstname> 

  <lastname>kohli</lastname> 

</employee>

Output:  virat     kohli

CDATA

CDATA means character data or unparsed character data.

CDATA is text that will NOT be parsed by a parser. Tags inside the text will NOT be treated as markup and entities will not be expanded.

Example

employee.dtd

<!ELEMENT employee (firstname,lastname)>  

<!ELEMENT firstname (#CDATA)>  

<!ELEMENT lastname (#CDATA)>  

employee.xml

<?xml version="1.0"?> 

<!DOCTYPE employee SYSTEM "employee.dtd"> 

<employee> 

  <firstname>virat </firstname> 

  <lastname>kohli</lastname> 

</employee>

Output: <firstname>virat </firstname>  <lastname>kohli</lastname> 

20. What is script manager in AJAX?

The key control in every ASP.NET Ajax-enabled application is the ScriptManager (in the Toolbox’s AJAX Extensions tab), which manages the JavaScript client-side code (called scripts) that enable asynchronous Ajax functionality. A benefit of using ASP.NET Ajax is that you do not need to know JavaScript to be able to use these scripts. The ScriptManager is meant for use with the controls in the Toolbox’s AJAX Extensions tab. There can be only one ScriptManager per page.

21. State the use of WSDL?

WSDL stands for Web Services Description Language

WSDL is used to describe web services

WSDL is written in XML

WSDL is often used in combination with SOAP(Simple Object Access Protocol) and an XML Schema to provide Web services over the Internet. A client program connecting to a Web service can read the WSDL file to determine what operations are available on the server. Any special datatypes used are embedded in the WSDL file in the form of XML Schema.



Write the HTML code to print following table.


<html>

<head><title>table example</title>

<style>

table,th,td{

border: 1px solid black;

}

</style>

</head>

<body>

<table>

    <tr>

        <td colspan="2">ONE</td>

        <td>TWO </td>

    </tr>

    <tr>

        <td rowspan="2">THREE</td>

        <td>FOUR</td>

        <td rowspan="2">SIX</td>

    </tr>

<tr>

    <td>FIVE</td>

</tr>

<tr>

    <td>SEVEN</td>

    <td colspan="2"> EIGHT</td>

</tr>

</table>

</body>

</html>

Wipro Elite sample questions

 Aptitude

1. The cost price of an article is Rs. 480. If it is to be sold at a profit of 6.25 percent,what would its selling price be?

A. 510        B. 530        C. 503        D. 519

2. The profit earned after selling an article for Rs 996 is the same as the loss incurred after selling the article for Rs 894. What is the cost price of the article ?

A. Rs 935            B. Rs 905                C. Rs 945                        D. Rs 975

3. The ages of Nishi and Vinnee are in the ratio of 6:5 After 9 years the ratio of their ages will be 9:8 What is the difference in their ages?

a) 9 years            b) 7 years                    c) 5 years                d) 3 years

4. Find out the wrong number in the given series

9050, 5675, 3478, 2147, 1418, 1077, 950

a) 3478                b) 1418                    c) 5673            d) 2147                e)1077

5. Profit earned by the organisation is distributed among officers and clerks in the ratio of 5:3 If the number of officers is 45 and the number of clerks is 80 and the amount received by each officer is rs 25,000 what was the total amount of profit earned?

A. Rs. 22 lakh        B. Rs. 18.25 lakh    C. Rs. 18 lakh    D. Rs. 23.25 lakh

6. A student wants to share his problem with his teacher and visits the teacher for the same at his home. In such a situation, the teacher should_

(A) Suggest to him to escape from his home

(B) Contact the student’s parents and provide help

(C) Warn him to never visit his home

(D) Extend reasonable help and boost his morale

7. If a student alleges against you for showing favoritism in evaluation of scripts, how would you deal with him? 

(A) Show his answer book and few more

(B) Reject his allegations

(C) Adopt punitive measure

(D) Make efforts to reveal his position



Hedger Problem Description

Hedger
Problem Description
A hedger is an investor who takes steps to reduce the risks of investment by doing appropriate research and analysis of stocks. Assume that you are a hedger. 

Now you have been given some parameters based on which you have to analyze and pick the correct stocks. You have been assigned a fund that you have to manage in such a way that it should give maximum returns.

According to your research you have a list of stocks for which you know the corresponding profit percentages that you can earn within a certain horizon. Being a hedger you don't want to put all your eggs in one basket. That's why you have decided the upper limit in terms of quantity that you will buy. 

Given number of stocks, the upper limit on quantity, the amount to be invested, the list of stock prices and list of profit percentages, calculate the maximum profit you can make. 

Note: All computation should be up to two digits after the decimal point. 

Constraints 
0 <= A <= 10^6
1 <= K <= 100
1 <= N <= 10^4

Input
First line contains three space separated integers N K A where N is number of stocks in Market, K is maximum quantity of any particular stock you can buy and A is capital amount you have.

Second line contains N space separated decimals denoting the prices of stocks. 

Third line contains N space separated decimals denoting the profit percentages corresponding to the index of stock prices. 

Output
Print the maximum profit that can be earned from the given amount, rounded to the nearest integer.

Time Limit 

Examples

Example 1

Input

4 2 100 

20 10 30 40 

5 10 30 20 

Output

26 

Explanation 

Here, we can select only two stocks of any stocks that we choose to buy. We choose to buy stocks which are priced at 30 and 40 respectively. Before we exhaust our capital maximum profit that can be earned
Profit=2*((30*30)/100) +1*((40*20)/100)=26 

Example 2 

Input 

5 3 200 
90 25.5 15.5 30.8 18.8 
5 10 20 5.5 2.5 

Output 

20 

Explanation 

Here, we can select only three stocks of any stocks that we choose to buy. We choose to buy stocks which are priced before we exhaust our capital maximum profit that can be earned.

Profit=3*((25.5*10)/100)+3*((15.5*20)/100)+2*((30.8*5.5)/100)=20.34 

Hence, output is 20.

What are the characteristics of Big Data?

Characteristics of Big Data:
The V's of Big Data:

1. Volume           --- The size of the data.
2. Velocity          --- Analysis of streaming data. The speed at which the data is being generated,          produced, created, or refreshed.
3. Variety            ---  Different types of data(Structured,Unstructured,Semi-structured)
4. Variability       --- The data whose meaning is constantly changing.
5. Veracity          --- Uncertainty of data (or) The trustworthiness of the data in terms of accuracy.
6. Visualization   --- The data in a manner that's readable and accessible.
7. Value             --- Just having BigData is of no use unless we can turn it into value.

Wednesday 5 August 2020

Capgemini Selection Process in 2020

Round 1: Pseudo code test
Round 2: English(Objective test)
Round 3: Game based aptitude
Round 4: Behaviour test
Round 5: Coding Test
(Only for differential for shortlists top performers)
Round 6: Virtual Interview

Offer: salary: 3.8 LPA

Tuesday 19 May 2020

HR interview questions?


1. Tell me about yourself?
2. Why should I hire you?
3. Tell me about your family background?
4. What are leadership qualities?
5. What do you expect from us?
6. Being an electrical engineer, why are you interested in IT?
7. Have you done any certification courses?
8. Why do you prefer TCS?
9. Why you have chosen IT industry as your career option?
10. How will you be an asset to the company?
11. What are your hobbies?
12. What is your home town famous for?
13. Do you have any problem with your locality?
14. Are you open to work at any place?
15. Which language you prefer more & why?
16. Suppose you are in a dark forest and there is no one around you. How would you get out of it?
17. How will your family react if we relocate you?