Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 25

TCS ASPIRE : Know your TCS quiz answers 2012

# Question 1 of 10 10.0 Points


When and where was TCS founded?
A. 1968, Mumbai
B. 1954, Mumbai
C. 1968, Jamshedpur
D. 1954, Coimbatore
Answer Key: A

# Question 2 of 10 10.0 Points


To how many industries does TCS provides its consultancy?
A. 12
B. 10
C. 20
D. 15
Answer Key: A

# Question 3 of 10 10.0 Points


What are the values of TCS?
A. Leading Change, Integrity, Responsibility, Excellence, Learning and propelling
B. Leading innovation, Integrity, Respect for the colleagues, Excellence, Mentoring and Sharing
C. Leading innovation, Integrity, Courteous, Certainty, Learning and Sharing Correct
D. Leading Change, Integrity, Respect for individual, Excellence, Learning and Sharing
Answer Key: D

# Question 4 of 10 10.0 Points


What is the name of the first research center established by TCS?
A. Tata Institute of Social Sciences (TISS)
B. Tata Research Development and Design Center (TRDDC)
C. Tata Institute of Fundamental Research (TIFR)
D. Indian Institute of Science (IISc)
Answer Key: B

# Question 5 of 10 10.0 Points


What was TCSs first onsite project?
A. Automating Johannesburg Stock Exchange
B. Burroughs (the first business computer manufacturer)
C. Developing electronic depository, SECOM for SIS SegaInterSettle, Switzerland
D. Institutional Group and Information Company (IGIC)
Answer Key: D

# Question 6 of 10 10.0 Points


TCS is .. largest IT firm in the world?
A. 8th
B. 2nd
C. 4th
D. 6th
Answer Key: A

# Question 7 of 10 10.0 Points


Who is TCS first General Manager?
A. JRD Tata
B. F.C Kohli
C. Ratan Tata
D. S. Ramadorai
Answer Key: B

# Question 8 of 10 10.0 Points


TCS provides six major IT services
A. Customer Development, Application Management, Migration and Re-engineering, System Integration, Testing,
Performance Engineering
B. Custom Application Development, Application Management, Migration and Re-engineering, Business
Management, Testing, Performance Engineering
C. Custom Application Development, Application Management, Migration and Re-engineering, System Integration,
Testing, Performance Engineering
D. Customer Development, Application Management, Migration and Re-engineering, Business Management, Testing,
Performance Engineering
Answer Key: B

# Question 9 of 10 10.0 Points


Which model does TCS follow?
A. Global Integrated Delivery Model
B. World Integrated Delivery Model
C. World Network Delivery Model
D. Global Network Delivery Model
Answer Key: D
# Question 10 of 10 10.0 Points
Tata Consulting Services goes public in Indias private sectors largest initial public offer in
A. 2006
B. 1999
C. 2004
D. 2002
Answer Key: C

TCS ASPIRE : Communication Quiz/question answers | latest 2012


# Question 1 of 20 10.0 Points
What does this Body language symbolize?
A. Intuitive
B. Anger
C. Irritated
D. Questioning
E. Insulting
Answer Key: D

# Question 2 of 20 10.0 Points


Choose the right phrase of the word. Ill be with you in ___________
A. A quarter of an hour.
B. A quarter of hour.
C. One quarter of an hour.
D. A quarter of one hour.
Answer Key: A

# Question 3 of 20 10.0 Points


Choose the right vocabulary which matches its meaning. Expressing one self readily, clearly, effectively
A. Eloquence
B. Understanding
C. Effective
D. Comprehensive

Answer Key: A

# Question 4 of 20 10.0 Points


Select the right option which indicates MTI ( Mother tongue influence) in the below given statement. What is
your good name?
A. Your good
B. Your
C. Name
D. Good name

Answer Key: D

# Question 5 of 20 10.0 Points


Identify the tense used in the following sentence: We built a tree house last week.
A. Present continuous
B. Past Perfect

C. Present Perfect
D. Simple Past

Answer Key: D

# Question 6 of 20 10.0 Points


Pick the correct option(past progressive tense): While Aaron_________ in his room, his friends________ in
the pool.
A. was workingwere swimming
B. was workingare swimming
C. was workingwas swimming
D. is workingare swimming

Answer Key: A

# Question 7 of 20 10.0 Points


Choose the correct verb form to complete the sentence. I ______ on my sofa all day yesterday.
A. lying
B. lay
C. lie
D. laid
Answer Key: B

# Question 8 of 20 10.0 Points Identify the incorrect part of the sentence: She dont understand / didnt understands /
didnt understand/didnt understanding the question yesterday.
A. didnt understanding
B. dont understand
C. didnt understand
D. didnt understands
Answer Key: C

# Question 9 of 20 10.0 Points


Please rewrite the following statement: We are simply loving it here.
A. We are simply loving.
B. We simply love it here.
C. We are simply here.
D. We love it here.
Answer Key: B

# Question 10 of 20 10.0 Points


What is the right response for the phrase How do you do?
A. I am fine,how about you?

B. I am fine thank you


C. How do you do?
D. I am not fine, by the way how are you?

Answer Key: C

# Question 11 of 20 10.0 Points


Arrange the following sections of a presentation in the correct order:
a. overview
b. introduction
c. start new section
d. analyse a point
e. give examples
f. finish section
g. paraphrase and clarify
h. summarize and conclude
i. inviting audience to ask questions/ discuss
A. a,d,b,c,e,f,h,g,i
B. a,b,d,c,e,f,h,g,i
C. a,b,c,d,e,f,g,h,i
D. b,a,c,d,e,f,h,g,i
Answer Key: D

# Question 12 of 20 10.0 Points


In the business arena:
A. It is not necessary for men or women to stand for handshaking and all introductions
B. Both men and women should stand for handshaking and all introductions
C. Only men should stand for handshaking and all introductions
D. Only women should stand for handshaking and all introductions
Answer Key: B

# Question 13 of 20 10.0 Points


Fill in the blanks with appropriate articles: At ____ (1) beginning of ____(2) twentieth century, East Los Angeles
became ____(3) popular immigrant destination.
A. the,a,the
B. the,an,a
C. the,the,the
D. the,the,a

Answer Key: D

# Question 14 of 20 10.0 Points


State whether this is true or false: Every presentation has its own target audience.
- True
- False

Answer Key: True

# Question 15 of 20 10.0 Points


Read the passage and answer the following:
FINDING A JOB
Not so long ago almost any student who successfully completed a university degree or diploma course
could find a good career quite easily. Companies toured the academic institutions, competing with each other to
recruit graduates. However, those days are gone, even in Hong Kong, and nowadays graduates often face strong
competition in the search for jobs.
Most careers organizations highlight three stages for graduates to follow in the process of securing a
suitable career: recognizing abilities, matching these to available vacancies and presenting them well to prospective
employers.
Job seekers have to make a careful assessment of their own abilities. One area of assessment should be of
their academic qualifications, which would include special skills within their subject area. Graduates should also
consider their own personal values and attitudes, or the relative importance to themselves of such matters as money,
security, leadership and caring for others. An honest assessment of personal interests and abilities such as creative
or scientific skills, or skills acquired from work experience, should also be given careful thought. The second stage is
to study the opportunities available for employment and to think about how the general employment situation is likely
to develop in the future. To do this, graduates can study job vacancies and information in newspapers or they can
visit a careers office, write to possible employers for information or contact friends or relatives who may already be
involved in a particular profession. After studying all the various options, they should be in a position to make
informed comparisons between various careers.
Good personal presentation is essential in the search for a good career. Job application forms and letters
should, of course, be filled in carefully and correctly, without grammar or spelling errors. Where additional information
is asked for, job seekers should describe their abilities and work experience in more depth, with examples if possible.
They should try to balance their own abilities with the employers needs, explain why they are interested in a career
with the particular company and try to show that they already know something about the company and its activities.
When graduates are asked to attend for interview, they should prepare properly by finding out all they can about the
prospective employer. Dressing suitably and arriving for the interview on time are also obviously important.
Interviewees should try to give positive and helpful answers and should not be afraid to ask questions about anything
they are unsure about. This is much better than pretending to understand aquestion and giving an unsuitable answer.

There will always be good career opportunities for people with ability, skills and determination; the secret to securing
a good job is to be one of them.

Question: In paragraph 3, three stages for graduates refers to:


A. all of the above
B. stages in the assessment of personal interests
C. stages in the process of securing a suitable career
D. stages for the completion of a university degree or diploma course .

Answer Key: C
# Question 16 of 20 10.0 Points
Read the passage and answer the following:
FINDING A JOB
Not so long ago almost any student who successfully completed a university degree or diploma course
could find a good career quite easily. Companies toured the academic institutions, competing with each other to
recruit graduates. However, those days are gone, even in Hong Kong, and nowadays graduates often face strong
competition in the search for jobs.
Most careers organizations highlight three stages for graduates to follow in the process of securing a
suitable career: recognizing abilities, matching these to available vacancies and presenting them well to prospective
employers.
Job seekers have to make a careful assessment of their own abilities. One area of assessment should
be of their academic qualifications, which would include special skills within their subject area. Graduates should also
consider their own personal values and attitudes, or the relative importance to themselves of such matters as money,
security, leadership and caring for others. An honest assessment of personal interests and abilities such as creative
or scientific skills, or skills acquired from work experience, should also be given careful thought. The second stage is
to study the opportunities available for employment and to think about how the general employment situation is likely
to develop in the future. To do this, graduates can study job vacancies and information in newspapers or they can
visit a careers office, write to possible employers for information or contact friends or relatives who may already be
involved in a particular profession. After studying all the various options, they should be in a position to make
informed comparisons between various careers.
Good personal presentation is essential in the search for a good career. Job application forms and letters
should, of course, be filled in carefully and correctly, without grammar or spelling errors. Where additional information
is asked for, job seekers should describe their abilities and work experience in more depth, with examples if possible.
They should try to balance their own abilities with the employers needs, explain why they are interested in a career
with the particular company and try to show that they already know something about the company and its activities.
When graduates are asked to attend for interview, they should prepare properly by finding out all they can about the
prospective employer. Dressing suitably and arriving for the interview on time are also obviously important.
Interviewees should try to give positive and helpful answers and should not be afraid to ask questions about anything

they are unsure about. This is much better than pretending to understand a question and giving an unsuitable
answer. There will always be good career opportunities for people with ability, skills and determination; the secret to
securing a good job is to be one of them.

Question: each other in paragraph 2 refers to:


A. available vacancies
B. career organizations
C. three stages
D. job seekers

Answer Key: B
# Question 17 of 20 10.0 Points
Choose the correct option. We_________ around the parking lot for 20 minutes in order to find a parking
space.
A. driven
B. drive
C. drove
D. drived

Answer Key: C
# Question 18 of 20 10.0 Points
Choose the correct option:
a)While I was writing the email, the computer suddenly went off.
b) When I write letters, the computer goes off.
c) Writing letters make my computer go off
A. None of the above
B. c
C. b
D. a

Answer Key: D
# Question 19 of 20 10.0 Points
Identify the tense: A rhinoceros was swatting flies with his tail when suddenly a fly bit him
A. Past Progressive
B. Past Simple
C. Past perfect continuous
D. Past perfect

Answer Key: A
# Question 20 of 20 10.0 Points
Choose the correct option: Not again! This is the third time that I . my keys since I .. home this
morning.
A. had lost/left
B. am losing/was leaving
C. will lose/have left
D. lose/had left
E. have lost/left

Answer Key: E

TCS ASPIRE: Basic Programming Quiz/questions | latest 2012


# Question 1 of 10 10.0 Points
What is a variable in a computer program?
A. An output
B. A value such as 5
C. The name given to a value
D. An input argument
Answer Key: C

# Question 2 of 10 10.0 Points


What is a semantic error ?
A. A program error that is difficult to debug
B. A program error that is not so important to take care
C. A program error that crashes the program
D. A program error that gives wrong output
Answer Key: D
# Question 3 of 10 10.0 Points
A variable will last until
A. the value of the variable is used in the program
B. The program completes and exit
C. Hard disc is formatted
D. Computer is switched off
Answer Key: B

# Question 4 of 10 10.0 Points


In a Javascript program, the word preceding the . represents
A. A program name
B. An object
C. An action by an object
D. A command
Answer Key: B

# Question 5 of 10 10.0 Points


What do you mean by a portable computer program?
A. The program can be attached to the port of a computer
B. The program is very small
C. It can be run on computers with different types of computers
D. It can be send from one computer to another computer
Answer Key: C

# Question 6 of 10 10.0 Points


A compiler will
A. Interpret the program line by line
B. Compile the program to create an executable
C. Link different programs written in same language together
D. Correct the errors in the program

Answer Key: B

# Question 7 of 10 10.0 Points


What

do

we

mean

by

the

performance

A. The utilization of resources such as CPU and memory by a program


B. The number of times a program can be run
C. The number of arguments that a program can handle
D. The speed with which a program runs

Answer Key: A

# Question 8 of 10 10.0 Points


What is debugging ?
A. Fine tuning the program for performance

of

program

B. The process of tracking and correcting the bugs in a program


C. Testing the program to identify defects
D. The process of removing the identified bugs
Answer Key: B

# Question 9 of 10 10.0 Points


Data structure enables
A. Analysis of the data used in a program
B. Connecting a program with database
C. Storing and organizing data in computer memory for efficient use
D. Structuring data in a program

Answer Key: C

# Question 10 of 10 10.0 Points


What is class in object oriented program ?
A. A collection of objects
B. A template to create objects
C. A variable type in a program
D. Category /Type of a program
Answer Key: B

TCS ASPIRE : UNIX quiz/question-answer 2012


# Question 1 of 10 10.0 Points
ls command in UNIX
A. Lists the files in a directory
B. Compare the size of two files
C. Gives the currently logged session details
D. Compares two numerals and prints the lower value
Answer Key: A

# Question 2 of 10 10.0 Points


Which among the following is not a part of UNIX operating system
A. Programs
B. Libraries
C. Kernel
D. Shell
Answer Key: B

# Question 3 of 10 10.0 Points


In UNIX, the shell act as an interface between user and
A. Kernel
B. Operating System
C. Hardware
D. Programs
Answer Key: A

# Question 4 of 10 10.0 Points


Everything in UNIX is
A. None
B. a Process
C. a file or a process
D. a File
Answer Key: C

# Question 5 of 10 10.0 Points


Which command is used for changing directory in UNIX?
A. mkdir
B. cd
C. chgdir
D. cddir
Answer Key: B

# Question 6 of 10 10.0 Points


In UNIX, file permissions are not set for
A. User
B. Other users
C. Devices
D. User Groups
Answer Key: C

# Question 7 of 10 10.0 Points


In Unix, how can you read the manual help pages about a command
A. Type help and the command
B. Type options and the command
C. Type details and the command
D. Type man and the command

Answer Key: D

# Question 8 of 10 10.0 Points


Which is the most common text editor in UNIX ?
A. Visual editor
B. notepad
C. Word
D. Open office

Answer Key: A

# Question 9 of 10 10.0 Points


You have created a shell script and wants to run the script. What should you do before trying to run the
script ?
A. No action required
B. Compile the script to create the executable
C. Update the execute permission of the script
D. Give ownership of the file to system admin

Answer Key: C

# Question 10 of 10 10.0 Points


Which is valid mode of operation in vi editor ?
A. Typing mode
B. Command Mode
C. Append mode
D. Open mode
Answer Key: B

TCS ASPIRE : software engineering quiz/question answer 2012


# Question 1 of 10 10.0 Points
Requirements can be classified in to two types, namely, functional requirements and non-functional
requirements
- True
- False
Answer Key: True

# Question 2 of 10 10.0 Points


Some examples of non-functional requirements are.
1.Number of significant digits to which accuracy should be maintained in all numerical calculations is 10
2.The response time of the system should always be less than 5 seconds
3.The software should be developed using C language on a UNIX based system
4.The matrix diagonalisation routine should zero out all off-diagonal elements, which are equal to or less
than 10-3

5.Experienced officers should be able to use all the system functions after a total training of two hours. After
this training, the average number of errors made by experienced officers should not exceed two per day.
- True
- False
Answer Key: True

# Question 3 of 10 10.0 Points


Every software system has the following essential characteristics:
A. It has processes which collaborate with each other to generate the outputs.
B. All the above
C. It has a boundary. The boundary separates what is with in system scope and what is outside.
D. The system may also use data stores to store data which has a life beyond the system.
E. These processes operate on data by creating, modifying, destroying, and querying it.
F. It takes inputs from external agents and generates outputs.
Answer Key: B

# Question 4 of 10 10.0 Points


ERD complements DFD. While DFD focuses on data and the relationships between them, ERD focuses on
processes and data flow between them
- True
- False
Answer Key: False

# Question 5 of 10 10.0 Points


Polymorphism: It is the means by which an operation behaves differently in different contexts.
- True
- False
Answer Key: True

# Question 6 of 10 10.0 Points


Encapsulation: This helps in controlling the visibility of internal details of the objects. It
improves security and integrity of data
- True
- False
Answer Key: True
# Question 7 of 10 10.0 Points
There are 4 types of Abstraction, namely Entity, Action, Virtual machine & Coincidental.
- True
- False
Answer Key: True

# Question 8 of 10 10.0 Points


There can be more than one hash fields on a file.
- True
- False
Answer Key: False

# Question 9 of 10 10.0 Points


Concurrency refers to multiple transactions accessing the same database at the same time. In a system
which allows concurrency, some kind of control mechanism has to be in place to ensure that concurrent
transactions do not interfere with each other.
- True
- False

Answer Key: True

# Question 10 of 10 10.0 Points


Software genetic development process contains three genetic phrases namely
A. Software engineering, Definition, Coding
B. Definition, development, maintenance
C. Coding, design, Software engineering
D. Design, Coding, Development
E. Development, Definition, Testing

Answer Key: B

TCS ASPIRE | Database management system quiz/question | latest


2012
# Question 1 of 10 10.0 Points
Which of the following options list the steps to convert a table to its second normal form?
A. All of the above
B. Find and remove fields that are related to the only part of the key.
C. Assign the new table with the key i.e. part of the whole composite key.
D. Group the removed items in the another table.

Answer Key: A
# Question 2 of 10 10.0 Points
In which of the following ways does TRUNCATE TABLE differ from DELETE?
A. All of the above

B. The number of deleted rows are not returned.


C. Truncate operations are not transaction safe.
D. Truncate operations drop and re-create the table which is much faster than deleting rows. one by one.

Answer Key: A
# Question 3 of 10 10.0 Points
Following tasks can be performed when using the ALTER TABLE
clause:
1.Change the name of the table
2.Change the name of the column
3.Decrease the size of a column if table data exists.
- True
- False

Answer Key: False


# Question 4 of 10 10.0 Points
Sometimes tables within particular database become obsolete and ought to be discarded. Which of the
following commands would you use for the same?
A. None of the above
B. REMOVE TABLE < TABLE NAME>
C. DROP TABLE < TABLE NAME >
D. DELETE TABLE < TABLE NAME >

Answer Key: C
# Question 5 of 10 10.0 Points
A foreign key must have a corresponding primary key or unique key value in the master table.
- True
- False

Answer Key: True


# Question 6 of 10 10.0 Points
NULL value is equivalent to a value of Zero if the data type is number
- True
- False

Answer Key: False

# Question 7 of 10 10.0 Points


Integrity constraint can be dropped if the rule that it enforces is not longer TRUE or if the constraint is no
longer needed.
- True
- False

Answer Key: True


# Question 8 of 10 10.0 Points
SELECT TRIM( Hansel ) Trim both sides FROM DUAL What would be the output of the above command?
A. None of the above
B. Trim both sides
C. Hansel
D. Trim both sides Hansel

Answer Key: D
# Question 9 of 10 10.0 Points
What would be the output of following command. SELECT TRANSLATE(1sct523,123, 7a9) Change
FROM DUAL;
A. 7sct 5a9
B. None of the above
C. 7 sct
D. Change 7 sct 5a9

Answer Key: D
# Question 10 of 10 10.0 Points
What is joining a Table to itself called?
A. Self Join
B. Outer join
C. Left inner join
D. Inner join

Answer Key: A

2012 TCS ASPIRE : Java quiz/question and answers latest


# Question 1 of 10 10.0 Points
Among the following options, choose the four options that describe the appropriate default values for array
elements of the types indicated?
1. int -> 0
2. String -> null
3. Dog -> null
4. char -> \u0000
5. float -> 0.0f
6.boolean -> true
A. 1, 2, 3, 4
B. 2, 4, 5, 6
C. 3, 4, 5, 6
D. 1, 3, 4, 5
Answer Key: D

# Question 2 of 10 10.0 Points


Which option among the following lists only Java programming language keywords?
A. goto, instanceof, native, finally, default, throws
B. byte, break, assert, switch, include
C. try, virtual, throw, final, volatile, transient
D. strictfp, constant, super, implements, do
E. class, if, void, long, Int, continue
Answer Key: A

# Question 3 of 10 10.0 Points


Which of the following options would legally declare, construct, and initialize an array?
A. int [] myList = {1, 2, 3};
B. int myList [] = {4, 3, 7};
C. int [] myList = (5, 8, 2);
D. int myList [] [] = {4,9,7,0};
Answer Key: B

# Question 4 of 10 10.0 Points


You want subclasses in any package to have access to members of a superclass. Which is the most restrictiveaccess
that accomplishes this objective?
A. private
B. transient
C. public
D. protected

Answer Key: C

# Question 5 of 10 10.0 Points


interface Base { boolean m1 (); byte m2(short s); }
1.interface Base2 implements Base {}
2.abstract class Class2 extends Base { public boolean m1(){ return true; }}
3.abstract class Class2 implements Base {}
4.abstract class Class2 implements Base { public boolean m1(){ return (7 > 4); }}
5.abstract class Class2 implements Base { protected boolean m1(){ return (5 > 7) }}
A. 3 and 4
B. 1 and 5
C. 1 and 2
D. 2 and 3
Answer Key: A

# Question 6 of 10 10.0 Points


Among the 6 options provided below, which three form part of correct array declarations?
1.public int a [ ]
2.static int [ ] a
3.public [ ] int a
4.private int a [3]
5.private int [3] a [ ]
6.public final int [ ] a
A. 2, 4, 5
B. 1, 3, 4
C. 2, 5, 6
D. 1, 2, 6

Answer Key: D

# Question 7 of 10 10.0 Points


Which of the following is/are legal method declarations?
1.protected abstract void m1();
2.static final void m1(){}
3.synchronized public final void m1() {}
4.private native void m1();
A. All of them are legal declarations.
B. 1 and 3
C. 2 and 4
D. 1 only

Answer Key: A

# Question 8 of 10 10.0 Points


Which three among the following are valid method signatures in an interface?
1.private int getArea();
2.public float getVol(float x);
3.public void main(String [] args);
4.public static void main(String [] args);
5.boolean setFlag(Boolean [] test);
A. 3, 4, and 5
B. 2 and 4
C. 1 and 2
D. 2, 3 and 5
Answer Key: D

# Question 9 of 10 10.0 Points


Which option among the following creates an instance of an array?
A. int[ ] ia = new int[15];
B. int ia[ ] [ ] = { 4, 5, 6 }, { 1,2,3 };
C. char[ ] ca = Some String;
D. float fa = new float[20];
Answer Key: A

# Question 10 of 10 10.0 Points


Which of the following class level (nonlocal) variable declarations will not compile?
A. volatile int d;
B. private synchronized int e;
C. protected int a;
D. transient int b = 3;
Answer Key: B

TCS ASPIRE : Unix Assignment 1 quiz answers 2012


# Question1:
Write a command to list all the files inside a folder i.e. if there is a folder inside a folder then it should list all
files inside the sub-folder which is inside the folder to be listed.

Answer: ls -aR
[Hint]
Ls =list information about files.
-a all (hidden files also), -R recursive (list subdirectories)

# Question 2:
Search all the files which contains a particular string, say include within a folder.

Answer: grep include ./*


[Hint]
Grep = searches the named input file for lines containing a match to the given pattern. ./* = In current directory (.), all
files(*)
# Question 3:
Rename all the files within a folder with suffix Unix_ i.e. suppose a folder has two files a.txt and b.pdf than
they both should be renamed from a single command to Unix_a.txt and Unix_b.pdf

Answer: for i in *.*;do mv $i Unix_$i;done;


[Hint]
Loop:
Syntax for variable in no of times;
Do command;
.;
Done;
Here: i= *.* (for all files)
$= to read value of variable.
do mv $i Unix_$i = rename *.* as Unix_*.*
# Question 4:
Rename all files within a folder with the first word of their content(remember all the files should be text files.
For example if a.txt contains Unix is an OS in its first line then a.txt should be renamed to Unix.txt

Answer: for i in *.txt; do head -1 $i > ad.txt ; x=$(cut -d -f1 ad.txt); mv $i $x.txt; done;
[Hint]
i = *.txt (all text files);
do head -1 $i > ad.txt; = prints first line and store in ad.txt file.
x=$(cut -d -f1 ad.txt) ; = removes first column (field) delimited by space from ad.txt file stores in x.
mv $i $x.txt; = rename *.txt as value of x .txt.
# Question 5:
Suppose you have a C project in a folder called project, it contains .c and .h files, it also contains some
other .txt files and .pdf files. Write a Linux command that will count the number of lines of your text files.
That means total line count of every file. (remember you have to count the lines in .txt files only)

Answer: wc l *.txt
[Hint]
Here: wc =word count
-l =to count lines
*.txt =all text files
# Question 6:
Rename all files which contain the sub-string foo, replacing it with bar within a given folder.

Answer: for i in ./*foo*;do mv $i ${i/foo/bar};done


# Question 7:
Show the most commonly used commands from history. [hint: remember the history command, use cut,
and sort it.

Answer: history|sort|cut -d -f1

TCS ASPIRE : Unix Assignment 2 quiz answers 2012


# Question 1:
Create a tree structure named training in which there are 3 subdirectories level 1, level2 and cep. Each
one is again further divided into 3. The level 1 is divided into sdp, re and se. From the subdirectory se
how can one reach the home directory in one step and also how to navigate to the subdirectory sdp in one
step? Give the commands, which do the above actions?

Answer : To navigate from 'se' to home directory,in one step,the command is : cd


To navigate from 'se' to 'sdp',in one step,the command is : cd ../b
# Question 2:
How will you copy a directory structure dir1 to dir2 ? (with all the subdirectories)
Answer : cp R dir1 dir2
# Question 3:
How can you find out if you have the permission to send a message?

Answer : ls -l ( To check access permissions)

# Question 4:
Find the space occupied ( in Bytes) by the /home directory including all its subdirectories.

Answer : du -s -b
# Question 5:
What is the command for printing the current time in 24-hour format?

Answer : date +%T


# Question 6:
Create the following files: chapa, chapb, chapc, chapd, chape, chapA, chapB, chapC, chapD, chapE, chap01,
chap02, chap03, chap04, chap05, chap11, chap12, chap13, chap14, and chap15.

Answer :
The general syntax is :
cat > filename
Type the contents of file
Press Ctrl+D
Example:
cat > chapa
Type the contents of file
Ctrl+D

# Question 7:
What is the command for printing the year, month, and date with a horizontal tab between the fields?

Answer : date +%Y%t%B%t%e


# Question 8:
With reference to question 7, What is the command for listing all files ending in small letters?

Answer : find name *[a-z].*


# Question 9:
With reference to question 7, What is the command for listing all files ending in capitals?

Answer : find name *[A-Z].*

# Question 9:
With reference to question 7, What is the command for listing all files ending in small letters?

Answer : find name *[a-z].*


# Question 10:
With reference to question 7, What is the command for listing all files whose last but one character is 0?

Answer : find name *0?.*


# Question 11:
With reference to question 7, What is the command for listing all files which end in small letters but not a
and c?

Answer : find name *[b d-z].*


# Question 12:
In an organisation one wants to know how many programmers are there. The employee data is stored in a file
called personnel with one record per employee. Every record has field for designation. How can grep be
used for this purpose?

Answer : grep -c "programmers" personnel


# Question 13:
In the organisation mentioned in question 12 how can sed be used to print only the records of all employees
who are programmers.

Answer : sed -n /programmers/p personnel


# Question 14:
In the organisation mentioned in question 12 how can sed be used to change the designation programmer
to software professional every where in the personnel file

Answer : sed 's/programmer/software professional/g' personnel


# Question 15:
Find out about the sleep command and start five jobs in the background, each one sleeping for 10 minutes.

Answer : sleep 10m & sleep 10m & sleep 10m & sleep 10m & sleep 10m &

# Question 16:
How do you get the status of all the processes running on the system? i.e. using what option?

Answer : ps -e

ALL CREDIT GOES TO TECHNOVARY!

You might also like