Showing posts with label PAT TEST. Show all posts
Showing posts with label PAT TEST. Show all posts

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..
Related Posts Plugin for WordPress, Blogger...