Tuesday 22 November 2011

TCS ASPIRE JAVA ASSIGNMENT - ANSWERS


1.
Program:

import java.io.*;
importjava.util.Scanner;
class Difference
{
publicstaticvoid main(String args[]) throwsIOException
{
Scanner s=newScanner(System.in);
System.out.println("Enter the value of n: ");
int n=s.nextInt();
int a[]=newint[n];
int i, sqr, diff, sum=0, add=0;
System.out.print("The "+n);
System.out.println(" numbers are : ");
for(i=0;i<n;i++)
{
a[i]=s.nextInt();
sum+=(a[i]*a[i]);
add+=a[i];
}
sqr=add*add;
diff=sqr-sum;
System.out.println("");
System.out.print("Sum of Squares of given "+n);
System.out.println(" numbers is : "+sum);
System.out.print("Squares of Sum of given "+n);
System.out.println(" numbers is : "+sqr);
System.out.println("");
System.out.println("Difference between sum of the squares and the square of the sum of given "+n);
System.out.print(" numbers is : "+diff);
System.out.println("");
}
}
Out put:

Enter the value of n:
3
The 3 numbers are :
2
3
4



Sum of Squares of given 4 numbers is : 29
Squares of Sum of given 4 numbers is : 81

Difference between sum of the squares and the square of the sum of given 4
numbers is : 52










2.
Program:

importjava.util.Scanner;


publicclassCalculateSquarePeri
{

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{

Scanner s=newScanner(System.in);
System.out.println("Area of Square : ");
double a=s.nextDouble();
double p=4*Math.sqrt(a);
System.out.println("");
System.out.print("Perimeter of the Square : "+p);
System.out.println("");
}


}


Output:

Enter the area:
23
Perimeter of the square is: 19.183326093250876











3.
Program:

import java.io.*;
importjava.util.Scanner;
classcalculateCylinderVolume
{
publicstaticvoid main(String args[]) throwsIOException
{
Scanner s=newScanner(System.in);
System.out.println("Enter the radius : ");
double rad=s.nextDouble();
System.out.println("Enter the height : ");
doubleht=s.nextDouble();
doublevol=Math.PI*rad*rad*ht;
System.out.println("");
System.out.println("Volume of the cylinder is : " + vol);
}
}


Output:

Enter the radius :
12
Enter the height :
13

Volume of the cylinder is : 5881.061447520093



4.
Program:

importjava.util.Scanner;


publicclasscalculateTax {

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s=newScanner(System.in);
System.out.println("Enter the no. of working days in the year : ");
int d=s.nextInt();
System.out.println("Enter the no. of working hours in a day : ");
int h=s.nextInt();
System.out.println("Enter the no. of hours worked in over time : ");
intot=s.nextInt();
System.out.println("Enter the no. of hours took leave : ");
int l=s.nextInt();
double gross=((d*h)+ot-l)*12;
double tax= gross*0.15;
double net=gross-tax;
System.out.println("");
System.out.println("Gross Pay (in $) : "+gross);
System.out.println("Tax (in $) : "+tax);
System.out.println("Net Pay (in $) : "+net);

}


}



Output:

Days worked by employer in a year :
300
Enter the no. of working hours in a day :
6
Enter the no. of hours worked in over time :
1
Enter the no. of hours took leave :
1560

Gross Pay (in $) : 2892.0
Tax (in $) : 433.8
Net Pay (in $) : 2458.2






5.


Program:
importjava.util.Scanner;


publicclasscalculateTotalProfit
{

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s = newScanner(System.in);
System.out.println("Enter the no. of attendees of a show : ");
int n=s.nextInt();
double profit = (n*5)-(20+(n*0.5));
System.out.println("");
System.out.println("Total Profit of the theater per show (in $) is : " + profit);
}


}
Output:
Enter the no. of attendees per show :
50

Total Profit of the theater per show (in $) is : 205.0







6.
Program:

importjava.util.Scanner;


publicclasscalculateCylinderArea
{

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s=newScanner(System.in);
System.out.println("Enter the base radius : ");
double rad=s.nextDouble();
System.out.println("Enter the height : ");
doubleht=s.nextDouble();
double area=2*Math.PI*rad*(rad+ht);
System.out.println("");
System.out.println("Surface Area of the cylinder is : " + area);
}

}


Output:

Enter the base radius :
12
Enter the height :
13

Surface Area of the cylinder is : 1884.9555921538758




7.

Program:

importjava.util.Scanner;


publicclasscalculatePipeArea
{

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s=newScanner(System.in);
System.out.println("Enter the inner radius : ");
double rad=s.nextDouble();
System.out.println("Enter the length : ");
doublelen=s.nextDouble();
System.out.println("Enter the thickness : ");
double thick=s.nextDouble();
double area=2*Math.PI*(rad+thick)*len;
System.out.println("");
System.out.println("Surface Area of the pipe is : " + area);

}


}


Output:

Enter the inner radius :
13
Enter the length :
20
Enter the thickness :
5

Surface Area of the pipe is : 2261.946710584651 




8.
importjava.util.Scanner;


publicclasscalculateHeight {

/**
* @paramargs
*/
publicstaticvoid main(String[] args) {
Scanner s=newScanner(System.in);
System.out.println("Enter the time (in seconds) : ");
double t=s.nextDouble();
double v=9.8*t;
double height=0.5*v*t;
System.out.println("");
System.out.println("Height reached (in meters) is : " + height);


}

}


Output:

Enter the time (in seconds) :
300

Height reached (in meters) is : 441000.0





9.
importjava.util.Scanner;


publicclassBoatDistance
{

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s= newScanner(System.in);
System.out.println("Enter the width of the river (in meters) : ");
doublerw=s.nextDouble();
System.out.println("Enter the river's speed (in meter/sec) : ");
doublers=s.nextDouble();
System.out.println("Enter the boat's speed (in meter/sec) : ");
doublebs=s.nextDouble();
double time=rw/bs; //time takes to travel from shore to shore straight by the boat
double w2=time*rs; //distance due to down stream
doublebd=Math.sqrt((rw*rw)+(w2*w2));
System.out.println("");
System.out.println("The distance travelled by boat (in meters) is : "+bd);
}


}


Output:

Enter the width of the river (in meters) :
15
Enter the river's speed (in meter/sec) :
200
Enter the boat's speed (in meter/sec) :
250

The distance travelled by boat (in meters) is : 19.209372712298546



10.
Program:

importjava.util.Scanner;


publicclasscalculateBalance {

/**
* @paramargs
*/
publicstaticvoid main(String[] args)
{
Scanner s=newScanner(System.in);
System.out.println("Enter the principal amount : ");
double p=s.nextDouble();
System.out.println("Enter the annual interest rate : ");
double r=s.nextDouble();
System.out.println("Enter the no. of months : ");
double m=s.nextDouble();
doublesi=(p*(m/12)*r)/100;
doublebal=p+si;
System.out.println("");
System.out.print("Balance after " +(int)m);
System.out.println(" month(s) is : "+bal);
}


}

Output:

Enter the principal amount :
15000
Enter the annual interest rate :
12
Enter the no. of months :
24

Balance after 24 month(s) is : 18600.0






You may also like this :

TCS ILP JAVA QUIZ ANSWERS


Sunday 20 November 2011

TCS ILP PAT TEST - DBMS ANSWERS and EXPLANATIONS


These are the answers correct to our perspective .please do confirm it.If you have alternate ideas for any questions please do comment on that you are always welcome .


1.The DBMS acts as an interface between what two components of an
enterprise-class database system?
A.Database application and the database
B.Data and the database
C.The user and the database application
D.Database application and SQL

Ans:  A,i think this question doesnt need any explanation.It is selfexplanatory.

2. SQL stands for ________ .
A.Structured Query Language
B.Sequential Query Language
C.Structured Question Language
D.Sequential Question Language

Ans: obivously it option A.

3. Because it contains a description of its own structure, a database is
considered to be _______ .
A.Described
B.metadata compatible
C.self-describing
D.an application program.

Ans: Again the question is self explanatory ,so answer is C.self describing.

4.You can add a row using SQL in a database with which of the following?
A.ADD
B.CREATE
C.INSERT
D.MAKE

Explanation: 

The INSERT INTO statement is used to insert a new row in a table.
syntax:
INSERT INTO table_name (column1, column2, column3,...)
VALUES (value1, value2, value3,...)

Ans: C

5.The wildcard in a SELECT statement is which of the following?
A.%
B.&
C.∗
D.#

Explanation:
SQL wildcards can substitute for one or more characters when searching for data in a database.

SQL wildcards must be used with the SQL LIKE operator.

we have the following "Persons" table:

P_Id         LastName              FirstName               Address City
1                             Hansen Ola          Timoteivn 10                 Sandnes
2                             Svendson Tove  Borgvn 23                     Sandnes
3                             Pettersen Kari        Storgt 20                       Stavanger

Using the % Wildcard

Now we want to select the persons living in a city that starts with "sa" from the "Persons" table.

We use the following SELECT statement:

SELECT * FROM Persons
WHERE City LIKE 'sa%'
The result-set will look like this:

P_Id LastName                  FirstName                      Address City
1 Hansen Ola                     Timoteivn 10                       Sandnes
2 Svendson Tove Borgvn 23                        Sandnes

courtesy : www.w3schools.com

Ans: A.%

6.The command to eliminate a row from a table is:
A.REMOVE FROM CUSTOMER
B.DROP FROM CUSTOMER
C.DELETE FROM CUSTOMER
D.UPDATE FROM CUSTOMER

Exp:
The DELETE statement is used to delete rows in a table.

SQL DELETE Syntax

DELETE FROM table_name
WHERE some_column=some_value

Ans:- C,where the CUSTOMER is the table name.


7. The SQL WHERE clause:
A.limits the column data that are returned.
B.limits the row data are returned.
C.Both A and B are correct.
D.Neither A nor B are correct.

Exp:
The WHERE clause is optional.The WHERE clause filters rows from the FROM clause tables. Omitting the WHERE clause specifies that all rows are used.

Ans: B

8. Which of the following is the original purpose of SQL?
A.To specify the syntax and semantics of SQL data definition language
B.To specify the syntax and semantics of SQL manipulation language
C.To define the data structures
D.All of the above.

Ans.D

9. The wildcard in a WHERE clause is useful when?
A.An exact match is necessary in a SELECT statement.
B.An exact match is not possible in a SELECT statement.
C.An exact match is necessary in a CREATE statement.
D.An exact match is not possible in a CREATE statement.

Exp:the explanation given in the 5 question can explain this question also.

Ans: B


10. A view is which of the following?
A.A virtual table that can be accessed via SQL commands
B.A virtual table that cannot be accessed via SQL commands
C.A base table that can be accessed via SQL commands
D.A base table that cannot be accessed via SQL commands


Explanation:
In SQL, a view is a virtual table based on the result-set of an SQL statement.A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.


Ans: A

11.The command to eliminate a table from a database is:
A.
REMOVE TABLE
CUSTOMER;
B.
DROP TABLE CUSTOMER;
C.
DELETE TABLE CUSTOMER;
D.
UPDATE TABLE
CUSTOMER;

Exp:
The DROP TABLE statement is used to delete a table.
syntex:
DROP TABLE table_name

Ans: B.where CUSTOMER  is the table name.

12. ON UPDATE CASCADE ensures which of the following?
A.
Normalization
B.
Data Integrity
C.
 Materialized Views
D.
All of the above.

Ans:B.Data Integrity

13. SQL data definition commands make up a(n) ________ .

A.DDL
B.DML
C.HTML 
D.XML

Exp: sql data definition commands make up a data definition language DDL
Ans:A


14. The SQL keyword(s) ________ is used with wildcards.
A.LIKE only
B.IN only
C.NOT IN only
D.IN and NOT IN

Exp:
SQL wildcards can substitute for one or more characters when searching for data in a database.
SQL wildcards must be used with the SQL LIKE operator.Example of 5 th question can be used to understand

Ans:A

15. Which of the following is the correct order of keywords for SQL SELECT
statements?
A.SELECT, FROM, WHERE
B.FROM, WHERE, SELECT
C. WHERE, FROM,SELECT
D.SELECT,WHERE,FROM

Exp:
Example statement :SELECT * FROM Persons
WHERE City LIKE 'sa%'

Ans:A

16. A subquery in an SQL SELECT statement is enclosed in:

A.braces — {...}.
B.CAPITAL LETTERS.
C.parenthesis — (...)
D.brackets — [...].

Ans:C parenthesis

17. The result of a SQL SELECT statement is a(n) ________ .

A.report
B.form
C.file
D.table

Ans: D.table

18. Which one is not the command of DDL?
A. create
B. alter
C. delete
D. drop

Ans: C




Saturday 19 November 2011

TCS ILP PAT TEST - JAVA ANSWERS and EXPLANATIONS


Please do confirm the answers,these are the answers which are correct to our perspective.

1.Which of the following statements is false about objects?
a.An instance of a class is an object
b.Objects can access both static and instance data
c.Object is the super class of all other classes
d.Objects do not permit encapsulation

EXP:
objects are clearly the instance of a class.So objects has nothing to do with super class.
Ans: C 

2.Which methods can access to private attributes of a class?
a.Only Static methods of the same class
b.Only instances of the same class
c.Only methods those defined in the same class
d.Only classes available in the same package.

Exp:
Private attributes cannot be accessed outside the class.The private keyword that means no one can access that member except that particular class, inside methods of that class. Other classes in the same package cannot access private members, so it is as if you a€™re even insulating the class against yourself.
for example :
class demo
{
int a;
public int b;
private int c; //private variable

void setc ( int k)
{c=k;}

void getc ()
{return c;}
}

class accessdemo
{
public static void main(String args[])
{
demo d1 = new demo();

d1.a=10;
d1.b=20;
//but this type of assigning is not possible with the private variable c
d1.c=30; //this is ERROR
//we can access the private variable like this,
d1.setc(30);
// it can be displayed as follows
System.out.println("a,b,c :" + d1.a +"   "+d1.b+"  "+d1.getc() );
}
}

thus from this we can know that 
Ans:C.Only methods those defined in the same class

3.What is an aggregate object?
a.An object with only primitive attributes
b.An instance of a class which has only static methods
c.An instance which has other objects
d.None of the above

EXP:An aggregate object is an object that contains other objects for the purpose of grouping those objects as a unit. It is also called a container or a collection. Examples are a linked list and a hash table.

Ans:C.An instance which has other objects

4.Assume that File is an abstract class and has to File() method. ImageFile and Binary File are concrete classes of the abstract class File. Also, assume that the method toFile() is implemented in both Binary File and Image File. A File references an ImageFile object in memory and the toFile method is called,
which implementation method will be called?

a.Binary File
b.Image File
c.Both File and Binary Files
d.None of the above

I cannot catch the question ,if anyone got the answer please comment it.thanks.

5.A class can have many methods with the same name as long as the number of
parameters or type of parameters is different. This OOP concept is known as
a.Method
b.Invocating
c.Method
d.Overriding
e.Method Labeling
f.Method
g.Overloading

EXP: you can understand it from the following example,the concept is called overloading.
class OverloadDemo { 
void test() { 
System.out.println("No parameters"); 
// Overload test for one integer parameter. 
void test(int a) { 
System.out.println("a: " + a); 
// Overload test for two integer parameters. 
void test(int a, int b) { 
System.out.println("a and b: " + a + " " + b); 
// overload test for a double parameter 
double test(double a) { 
System.out.println("double a: " + a); 
return a*a; 
class Overload { 
public static void main(String args[]) { 
OverloadDemo ob = new OverloadDemo(); 
double result; 
// call all versions of test() 
ob.test(); 
ob.test(10); 
ob.test(10, 20); 
result = ob.test(123.2); 
System.out.println("Result of ob.test(123.2): " + result); 
}

Ans: g.overloading.

6.Which of the following is considered as a blue print that defines the variables
and methods common to all of its objects of a specific kind?
a.Object
b.Class
c.Method
d.Real data
e.types

Ans: i think this question doesnt need explanation.the answer is B.class

7.What are the two parts of a value of type double?
a.Significant Digits,
b.Exponent
c.Length, Denominator
d.Mode, Numerator

Ans: significant digits and exponent  are the two parts of a value of type double.

8.After the following code fragment, what is the value in fname?
Code:
String str;
int fname;
str = "Foolish boy.";
fname = str.indexOf("fool");
a.2
b.-1
c.4

Exp:The indexOf method is used to locate a character or string within another string.It returns -1 when the string is not present.Here as it is fool (not f caps) it will return -1,so answer will be -1

Ans: B.-1

9.What is the value of ‘number’ after the following code fragment execution?
Code:
int number = 0;
int number2 = 12
while (number < number2)
{number = number + 1;
}
a.5
b.12
c.21
d.13

Exp:This is very simple,here the loop executes untill the number becomes greater or equal to number2.So now when the number value is 11 it enters the loop and now number becomes 12,now again when the condition is checked the condition is false.Hence the number value will be 12.

Ans:B.12
10.10.Given the following code snippet;
Code:
int salaries[];
int index = 0;
salaries = new int salaries[4];
while (index < 4)
{
salaries[index] = 10000;
index++;
}
What is the value of salaries [3]?
a.4000
b.5000
c.1500
d.1000

Ans:Here the index value is alone increamented hence all the values of salaries will be 10000.But there is no option stating 10000.

12.Which of the following is not a return type?
a.boolean
b.void
c.public
d.Button

Ans:d.button.

13.If result = 2 + 3 * 5, what is the value and type of ‘result’ variable?
a.17,byte
b.25, byte
c.17, int
d.25, int

Ans:C.17,int reason:priority is multiplication and then addition.

14.What is the data type for the number 9.6352?
a.float
b.double
c.Float
d.Double

Exp:i believe in executing things,so as we executed the following program,

public  class floattest
{
public static void main(String[] args)
{

float f;
f=9.6352 ;
System.out.println("F value is:"+f);
}

}


javac floattest.java
gava the result -- possible loss of precision.

Ans: B. double

15.Assume that the value 3929.92 is of type ‘float’. How to assign this value
after declaring the variable ‘interest’ of type float?
a.interest = 3929.92
b.interest = (Float)3929.92
c.interest = 3929.92(float)
d.interest = 3929.92f

working on the rest stay connected !!!!

Friday 11 November 2011

TCS ILP PAT TEST SOLUTIONS

My friend attended the test and we tried to solve the questions.Here are some.Answer provided are true to our perspective,please do confirm it.Please post your comments,and if you know any answers you are welcome to  post it.

1.UNIX uses ls to list files in a directory. The corresponding command in MS
environment is:
a. lf
b. listdir
c. dir

ANS : C


2.A file with extension .txt

a. Is a text file created using vi editor
b. Is a text file created using a notepad
c. Is a text file created using word

ANS:File created with notepad will have .txt extension.

3. In the windows environment file extension identifies the application that created it. If we remove the file extension can we still open the file?
a. Yes
b. No

ANS: yes
You can check this by yourself.Go to control panel  and open folder options and then  open views tab,here uncheck hide extensions for known file types.Then you can rename the file along with extension.So now by the given problem remove the file extensions by deleting the extension.Now when we try to open this,windows is confused with which application it has to be opened.Hence it shows the dialog box to open the file.we can select the preferred apps to open this.After selection windows opens the file.Thats it !! hence proved..


4. Which of the following files in the current directory are identified by the regular expression a?b*.
a. afile
b. aab
c. abb
d. abc
e. axbb
f. abxy

Ans: b.aab c.abb e.axbb

5.For some file the access permissions are modified to 764. Which of the following interpretation are valid:
a. Every one can read, group can execute only and the owner can read and write.
b. Every one can read and write, but owner alone can execute.
c. Every one can read, group including owner can write, owner alone can execute

Ans: C
Reason is that 764 means
owner - 7 - 111 - read write and execute
group  -6 - 110  - read and write only
others -4 -100 - read only

6.The file’s properties in Windows environment include which amongst the following:
a. File owners’ name
b. File size
c. The date of last modification
d. Date of file creation
e. The folder where it is located

Ans:Actually we can notice all the details in the file properties  dialog box .

7. Which of the following information is contained in inode structure

a. The file size
b. The name of the owner of the file
c. The access permissions for the file
d. All the dates of modification since the file’s creation
e. The number of symbolic links for this file

Ans: inode structure consists of  file type,link count,owners id,group's id,file size,file address,last access to file,last modified,last inode modification.Microsofts counterpart of an inode is file control block (FCB)

8.File which are linked have as many inodes as are the links.
a. True
b. False

9. Which directory under the root contains the information on devices
a. /usr/bin
b. /usr/sbin
c. /usr/peripherals/dev
d. /etc/dev

10 A contiguous allocation is the best allocation policy.
a.True
b.False

11.An indexed allocation policy affords faster information retrieval than the chained allocation policy.
a. True
b. False

12.An indexed allocation policy affords faster information retrieval than the chained allocation policy.

a. True
b. False

Ans: in general indexed allocation is faster.


13. Absolute path names begin by identifying path from the root.
a. True
b. False


Ans: True.

preparing the rest ..soon will be updated..

Saturday 5 November 2011

communication quiz vocabulary activity- TCS pre - ilp Aspire assignment


communication quiz answers - TCS pre - ilp Aspire assignment

These are the communication quizzes answers.I hope you can crack it by your own.Its just for your reference.Thanks to my friend and ilp community for this.

























DBMS TCS pre-ilp Assignment




My friend was preparing for his aspire assignments , he informed me that this materials would help many students.Thanks to my friend and ilp community.This material i hope will inculcate a good idea for creating your own answers.The material provided is only for idea gathering purpose only.Please dont try to mimic the answers,because  i believe you can come with with even more efficient answers.




Question 1:
Provide the create table syntax to Create a Table Employee whose details are as below.Employee(EmployeeID,
LastName, FirstName, Address, DateHired)

Ans: create table Employee(  EmployeeID int(6) primary key,LastName varchar(20),FirstName varchar(20),Address varchar2(50),datehired date );


Question 2:
Provide the INSERT query to be used in Employee Table to fill the Details.
ANS: Insert into Employee values( 100,'gourav','kishan','hyderabad','15-aug-45');



Question 3:
When we give SELECT * FROM EMPLOYEE .How does it Respond?
Ans: when we type the following query of select * from employee it returns all the data present that is all the columns in employee table. In this case it shows the above value in the insert statement.


Question 4:
 Create a Table CLIENT whose details are as below.
 Client(ClientID, LastName, FirstName, Balance, EmployeeID)
 ANS:create table Client(ClientID int(6), LastName varchar(20), FirstName varchar(20), Balance float(10) , EmployeeID foreign key references Employee(EmployeeID));
  NOTE: INCASE IF WE USE BOTH EMP AND CLIENT TABLE IN 1 DB..OR HAS A RELATION FOREIGN KEY OR NOT NULL AND REFERENCES ARE REQUIRED ELSE NO NEEDED.



Question 5:
Provide the INSERT query to be used in CLIENT Table to fill the Details.
 ANS:INSERT INTO Client
      values(&ClientID,'&LastName','&FirstName','&Address', &EmployeeId);


Question 6:
When we give SELECT * FROM CLIENT .How does it Respond?
ANS: It returns all the rows and columns present in the client table . that is it shows all the field data of client table.


Question 7: Choose the correct answer. The SQL command to create a table is:

 a. Make Table

 b. Alter Table
  c. Define Table

 d. Create Table

Ans : D


Question 8:
Choose the correct answer. The DROP TABLE statement:

 a. deletes the table structure only

 b. deletes the table structure along with the table data

 c. works whether or not referential integrity constraints would be violated

 d. is not an SQL statement

 ANS: b


Question 9:
What are the different data types available in SQL server?
Ans:
    1) Numeric        : Stores numeric values.
    2) Monetary       : It stores numeric values with decimal
                     places. It is used specially for currency values.
    3) Date and Time  : It stores date and time information.
    4) Character      : It supports character based values of
                                   varying lengths.
    5) Binary         : It stores data in strict binary (0 or 1)
                               representation.
    6) Special purpose: SQL Server contains Complex data
        types to handle the XML Documents,Globally unique
        identifiers etc.


Question 10:
Which is the subset of SQL commands used to manipulate Oracle Database structures, including tables?
 ANS: DDL( Data Deifinition Language).



Question 11:
What operator performs pattern matching?

ANS: LIKE Operator.


Question 12:
What operator tests column for the absence of data?
 ANS: IS NULL Operator.


Question 13:
Which command executes the contents of a specified file?
  ANS: START or @ command.


Question 14:
What is the parameter substitution symbol used with INSERT INTO command?
 ANS: '&' commonly known as amperescent operator.


Question 15:
Which command displays the SQL command in the SQL buffer, and then executes it?
  ANS: RUN.


 Question 16:
 What are the wildcards used for pattern Matching?
  ANS: _ and %
   _  = single character substitution .
   % = multiple character substitution.
[CHARLIST] = any single charecter in CHARLIST
^[CHARLIST] = any single charecter NOT in CHARLIST


 Question 17: State whether true or false.

 EXISTS, SOME, ANY are operators in SQL.
   ANS: TRUE.


 Question 18: State whether true or false.

 !=, <>, ^= all denote the same operation.
  ANS: TRUE.


Question 19: What are the privileges that can be granted on a table by a user to others?
 Ans: Insert, update, delete, select, references, index, execute, alter, all


Question 20:
What command is used to get back the privileges offered by the GRANT command?
 ANS: REVOKE.


Question 21:
Which system tables contain information on privileges granted and privileges obtained?
 ANS : USER_TAB_PRIVS_MADE,
           USER_TAB_PRIVS_RECD .


Question 22:
Which system table contains information on constraints on all the tables created?
 ANS: USER_CONSTRAINTS.


Question 23:
What is the difference between TRUNCATE and DELETE commands?
 ANS:  1.Delete is a DML command and Truncate is a
              DDL  command.
           2.Where clause can be used with delete only.
           3.THE Delete operation can be rolled back, Truncate operation cant be rolled back again that is it is a permanent delete.


Question 24:
What command is used to create a table by copying the structure of another table?

ANS: CREATE TABLE .. AS SELECT command



Basics of programming - Aspire Assignment


My friend was preparing for his aspire assignments , he informed me that this materials would help many students.Thanks to my friend and ilp community.This material i hope will inculcate a good idea for creating your own program.The material provided is only for idea gathering purpose only.Please dont try to mimic the programs,because  i believe you can write even more efficient programs.


QUESTION 1:NAME FINDING PROGRAM


Search for a name

Write a program to accept an array of names and a name and check whether the

name is present in the array. Return the count of occurrence. Use the following

array as input

{“Dave”, “Ann”, “George”, “Sam”, “Ted”, “Gag”, “Saj”, “Agati”, “Mary”, “Sam”,

“Ayan”, “Dev”, “Kity”, “Meery”, “Smith”, “Johnson”, “Bill”, “Williams”, “Jones”,

“Brown”, “Davis”, “Miller”, “Wilson”, “Moore”, “Taylor, “Anderson”, “Thomas”,

“Jackson”}



import java.io.*;
import java.util.StringTokenizer;
public class namefinding
{
 public static void main(String args[])throws Exception
{
 InputStreamReader isr=new InputStreamReader(System.in);
 BufferedReader br=new BufferedReader(isr);
System.out.println(".........................WELCOME TO THE NAME FINDING PROGRAM.......................");
System.out.println("enter names by using space inbetween:");
String arrNames=br.readLine();
StringTokenizer st1=new StringTokenizer(arrNames);
System.out.println("enter the name to be searched:");
String name=br.readLine();
int countNoOccurance=0;
while(st1.hasMoreTokens())
{
if(name.equalsIgnoreCase(st1.nextToken()))
{
countNoOccurance++;
}
}
System.out.println("THE NAME "+name+" HAS APPEARED "+countNoOccurance+" TIMES");
}
}



IMPROVE UNDERSTANDABILITY OF THE BELOW GIVEN CODE:


import java.util.*;

class problem3
{

int[] numArray=new int[10];  //an array named numarray is assigned containing 10 elements

public static void incrementElements (int[] integerArray) //the function is static it can be activated either by using class name or by an object. Passing array of integers as an argument

{
int arraylen = integerArray.length;//the array length is calculated using integerArray.length

for (int i = 0; i < arraylen; i ++)

{

System.out.println(integerArray[i]);

}

for (int i = 0; i < arraylen; i ++)//Using for loop we set a loop from 0 to the obtained length of the array

{

integerArray[i] = integerArray[i] + 10;//The present integer value is incremented, by a value of 10

}

for (int i=0; i < arraylen; i ++) // result is displayed using an array


{


System.out.println(integerArray[i]);


}


}







QUESTION 2:


Greatest common divisor

Calculate the greatest common divisor of two positive numbers a and b.

gcd(a,b) is recursively defined as

gcd(a,b) = a if a =b

gcd(a,b) = gcd(a-b, b) if a >b

gcd(a,b) = gcd(a, b-a) if b > a


import java.io.*;
import java.util.Scanner;
class gcdfinder
{
 public static void main(String args[])
   {
Scanner sr= new Scanner(System.in);
System.out.println("................welcome to the gcd finder program...................................");
     System.out.println("Enter the value for a");
     int a=sr.nextInt();
  System.out.println("Enter the value for b");
  int b=sr.nextInt();
  int gcd;
  if(a==b)
     gcd=a;
  else if(a>b)
     gcd=findgcd(a-b,b);
  else
     gcd=findgcd(b,b-a);
  System.out.println("The greatest common divisor of numbers " + a + " and " + b + " is " + gcd);
System.out.println("Thanks for executing the program");
    }
 public static int findgcd(int c,int d)
  {
  if (d == 0)
     return c;
  return findgcd(d, c % d);
  }
  }




IMPROVE UNDERSTANDABILITY:



class Problem1 //class name is problem1

{

int[] a;

int nElems;

public ArrayBub(int max)

{

a = new int[max];

}

public void insert(int value)

{

a[nElems] = value;

nElems++;

}

public void Sort() //sorting is done like bubble sort algorithm

{

int out, in;

for(out=nElems-1; out>1; out--)

for(in=0; in<out; in++)

if( a[in] > a[in+1] ) // comparing  one number with another.

swap(in, in+1); }

public void swap(int one, int two) //swapping takes place

{

long temp = a[one];

a[one] = a[two];

a[two] = temp;

}


Monday 31 October 2011

Nanban songs


Nanban film is the remake of 3 idiots ,directed by shankar ,and starred by vijay.The music is composed by Harris Jeyaraj.As many i was also excited to know about the songs.Here are the songs details of the film
Nanban poster
Track List of Nanban:
1.Love Battery
(All is Well)
Singers: Vijay Prakash
Lyrics : MadhanKark y
2.Nee Yen Nanban
Singers: Benny Dayal, Blaaze
3.Uyire Engai
Singers: Hariharan, Chinmayee
4.Killi Killi
Singers: Haricharan , Ranjith
5.My Friend
Singers: Krish

Saturday 29 October 2011

How to find my missing mobile phone ?


Missing mobile phones is increasingly popular and with latest technologies there is no need of panic !!

Most precautious way to do  to protect mobile phones of any model and company is to note down the IMEI number.IMEI stands for International Mobile Equipment Identity and this number can be known by simply typing   *#06#  on the keypad.Incase the mobile phone is lost this IMEI number can be used to trace your mobile phone,in the worst case you can ask your service provider to block the mobile phone.This will make the mobile phone useless with any operator's sim. More interestingly,mobile manufacturers provide handy solutions to this.For example apple iphones have their options to protect their phones like undercover ,Mobile me service, Find my iphone app,gadget trak,traptrace.In samsung one can use a sms based protection system which my friend is using now.Here you need to enter a phone number which will be stored in the phone.Now when any one changes sim ,now a message will be sent to the stored phone number stating that sim is changed in our mobile.In the case of theft we can know which sim is being used in our mobile.so that we can directly deal with that person.

so many mobile phone vendors have started giving support to theft protection.But one of the best way to protect our mobile is note the IMEI number because it works with any kind of mobile phone even with very old non-multimedia mobile phones.

Stock market - a gambling game ??



I always believe that trading in stock market is never a gambling game.The bullish and bearish that is the upside and downfall of market depends on various factors.Each and every movement of the market has some reason to it.It is the numerous factors it depends on makes it difficult to predict.Any person who don't understand the factors always believe that its a gambling game.A good trader will always have the opportunity to trade whether in bullish or bearish market.

Indian markets mainly reacts to two major factors,i usually call it as double 'I's,

1.Inflation
2.Interest rates.

offcourse there are numerous other factors that can cause shakes in stock market.

chmod problem , sudo broken ,how to recover

  when i was learning about linux commands , without knowing the consequences of the command 

  sudo chmod -777 /


i executed it.It was the last command i executed with sudo.As each system  file has their own configured file access permissions, executing the above command broke all those default permissions and also broke the sudo.I was not able to access the sudo command after that.So please dont try the above command.If you the person who has already been in the trap please insert a live cd and try the following code,



#!/bin/bash

echo "What is your ubuntu partition? (/dev/sd??)"
read -p"/dev/sd" deviceID

mkdir /media/temp4567
sudo mount /dev/sd$deviceID /media/temp4567

find /etc -maxdepth 20 | while read filename; do
    if [ -a "/media/temp4567/$filename" ]; then
        curPerm=$(stat --format=%a $filename)
    sudo chmod $curPerm "/media/temp4567/$filename"
    fi
done

thanks to my friend mike for this code.I recovered from chmod problem by using  the code.try this!!

F1 in India


In India as for as sports is concerned cricket is everything.Cricket is famous to the level that it makes people to think that it is the national game.Infact hockey is the national game of india.

Now as an indian i am very proud to hear that F1 racing is happening in India.But the popularity of F1 in india is very poor.Critics say that there is a bigger business perspective in bringing F1 racing to india.Beyond the criticism Indians are happy to see great F1 drivers like michael schumacher speaking to television channels.Here are some informations to people who like me wants to know about F1 racing.let me put it in steps for easy reference,

Inagural session happened in 1950
most interestingly "formula" means set of rules that the participants car should meet
In india this is the first time F1 grand prix is happening.(in oct 2011)
grands prix means grand prizes,here most interestingly the drivers and the car constructors need to possess a license to participate in this racing.The license is known as super license.
Greater Noida is the place where this time F1 grand prix is held.

cheke de india!!!!!!!


Friday 28 October 2011

What is karur famous for ?


 Karur is a small city lcoated in tamil nadu.After staying in karur , i came to know about many unknown facts.They are,

1.It is the home/base of the very famous karur vysya bank.
2.It is asia's one of the largest bus body building centers.The speciality lies in the manual body building where in the bus owners can choose their own bus designs and structures,which is normally not possible with automated system of bus body building.
3.It is also very famous for textiles.The reason is that  it is located near Coimbatore,which is the manchester of south india.
4.karur houses the famous kalyana pasupadhesswarar temple.
5.Other than these things we can find many cbse schools in karur.
6.The famous chettinad cement factory is located in pulur in karur.

Upto to my knowledge these are the things that sparks me when i think of karur..

Documents required to open demat account?


Documents required to open demat account?

This question is often one asks to their DPs.Here is the list,

PAN (permanent account number) card
Bank passbook (account should be in your name)lastest transactions
cheque leaf
photo proof like voter id,ration card,driving license.

How to start trading in share market?


how to start trading in share market?

I love to trade as many others. i am trading in Indian sensex and Nifty markets.I had this question in my mind before start trading.so i would like to provide some information so that it will be easy for newbies.

step 1:
To trade in any market you need to have demat account.
Demat account can be opened with registered DPs like

share khan
IIFL
sbi demat
HDFC demat and so on.

Demat account forms will be available with these registered DPs.

step 2:
Demat account normally has two ways of access like

offline mode
online mode

offline mode:here you will call your DP appointed person and ask him to buy shares with the money in your demat account.

online mode:here you will be given a software terminal and you can buy and sell shares on your own.

step 3:
Now choose your way of access and say to your DP which mode of access do you want.you can even have both ways of access in your pocket.Personally i have the access to both online and offline mode.offline mode can be used when you are out..

step 4:
After filling the demat account forms ,now you need to provide a cheque of desired amount with which you want to trade.Some DPs have minimum balance limit like Rs.10000.

step 5:
This is the waiting period,it takes atleast a week to get your demat account approved from the date of submission of the form.

thats it now u are ready to trade.HAPPY TRADING.


Related Posts Plugin for WordPress, Blogger...