Tuesday, January 2, 2018

TCS Aspire: Python Questions with Answers

1. Correct name of caller function

1. funct
2. func()
3. func([param])
4. None of the above

Answer : func([param])


2. When a function does not return  any value, what value is thrown by it, by default when execute in shell

1. int
2. bool
3. None of the above
4. void

Answer : None of the above


3. Which type of argument assumes a default value if a value is not provided in their function call for that argument.

1. default argument

Answer : default argument

4. Whats get printed

def f( ):pass
print type(f())

1. <type 'function'>
2. <type 'type'>
3. <type 'Nontype'>
4. <type 'str'>

Answer : <type 'Nontype'>


5. Argument passed to function in correct potential order is called as

1. required argument
2. keyword argument
3. default argument
4. variable length argument

Answer : required argument


6. def func(x<5):

"""comment"""

return x

print func(x=4)

1. 5 
2. 4 
3. Error 
4. 0

Answer : 4


7. What is the return value of trunc()

1. int
2. bool
3. float
4. None of the above

Answer : int


8. Which of the following is correct def of variable length arguments

1. def func(param):
2. def func(*param):
3. def func(^param):
4. def func(@param):

Answer : def func(*param):


9. set = { } is a 
1. tuple
2. dictionary
3. set
4. list

Answer : dictionary


10. Python dictionaries are also called as

1. associative arrays
2. hash tables
3. Both A and B
4. None of the above

Answer : Both A and B


11. Which of the following is immutable

1. tuple
2. list
3. dic
4. All of the above

Answer : tuple


12. In order to store value in terms of key and values. We use what datatype

1. list
2. tuple
3. dic
4. last

Answer : dic


13. print ({'a':'b','a':'c'}) output is

1. Error
2. {'a':'b','a':'c'}
3. {'a':'c'}
4. {'a':'b'}

Answer : {'a':'c'}


14. If L1 is a list, output of cmp(L1,L1) is

1. 1 
2. -1
3. 0
4. Error

Answer : 0


15. list=['a','b','c','d','e']

    print list[10:]. What is output

1. Index Error
2. [ ]
3. ['a']
4. ['e']

Answer : [ ]


16. Which of the following method use to construct dictionary to list

1. keys( )
2. values( )
3. items( )
4. get( )

Answer : items( )


17. operator to remove list

1. remove
2. erase
3. del
4. delete

Answer : del


18. Which of the following is not built in method of list

1. append( )
2. insert( )
3. add ( )
4. count( )

Answer : add ( )


19. for i in range(0,1):

1. 0 
2. 10 
3. 11  
4. None of the above

Answer : 11


20. While a<3:

    a=a+1

    print a;

    break

  if a & 1

output is

1. 2  
2. 2 3 
3. 2 3 4 
4. None of the above

Answer : 2


21.How many times will loop execute ?

x=0

for x in range (0,5): 

if x

x+=1

1. 3
2. 4
3. 5
4. 6

Answer : 5


22. range(0,4,2) output

1. 0 2 
2. 0 1 3 
3. 0 2 4 
4. 0 1 2 3

Answer : 0 2 


23. for i in range(0,2):

 for j in range ( i,2) :

print j;

1. 011
2. 11
3. 012
4. 0,12

Answer : 011


24. Which of the following method is used to delete a file

1. os.delete( )
2. file.delete( )
3. os.remove( )
4. file.remove( )

Answer : os.remove( )


25. Which of the following is used to display the current position in a file 

1. seek ( )
2. tell( )
3. seek(pos)
4. set( )

Answer : tell( )

Sunday, December 31, 2017

TCS ASPIRE : UNIX quiz/question-answer 2016 - 2017

# 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 
[ Tips: “ls” command in UNIX lists all the contents in a directory. Ls can be used with many options to display additional details ]
# 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
[ Tips: Libraries. The UNIX operating system is made up of three parts; the kernel, the shell and the programs. ]
# 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
[ Tips: The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. ] 
# 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
[ Tips: Everything in UNIX is either a file or a process. A process is an executing program identified by a unique PID (process identifier). A file is a collection of data. They are created by users using text editors, running compilers etc. ]
# 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
[ Tips: The command cd directory means change the current working directory to ‘directory’. The current working directory may be thought of as the directory you are in, i.e. your current position in the file-system tree. ] 
# 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
[ Tips: Every directory and file on the system has an owner, and also an associated group. It also has a set of permission flags which specify separate read, write and execute permissions for the ‘user’ (owner), ‘group’, and ‘other’ (everyone else with an account on the computer) ]
# 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
[ Tips: To see what all a Linux command can do, type “man ”. This will show you the manual of the specified command.] 
# 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
[ Tips: The default editor that comes with the UNIX operating system is called vi (visual editor). Alternate editors for UNIX environments include pico and emacs, a product of GNU.]
# 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
[ Tips: You have to update the execute permission of the script using the command ‘chmod’]
# 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
[ Tips: The UNIX vi editor has two modes of operation:
1.Command mode commands which cause action to be taken on the file, and
2.Insert mode in which entered text is inserted into the file.
In the command mode, every character typed is a command that does something to the text file being edited; a character typed in the command mode may even cause the vi editor to enter the insert mode. In the insert mode, every character typed is added to the text in the file; pressing the (Escape) key turns off the Insert mode.]

TCS ASPIRE : Know your TCS test 2016 - 2017

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
[ Tips: The correct answer is 1968, Mumbai. In 1968, TCS was formed as division of TATA Sons. It started as Tata Computer Center. Its main business was to provide computer services to other group companies. An electrical engineer from the Tata Electric Companies, Fakir Chand Kohli, was brought in as the first General Manager. Soon after, the company was named Tata Consultancy Services.TCS is headquartered in Mumbai, and operates in more than 42 countries and has more than 142 offices across the world.] 
# 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
[ Tips: The correct answer is 12. 1) Banking and Financial Services 2) Energy, Resources and Utilities 3) Government 4) Healthcare 5) High-tech 6)Insurance 7)Life Sciences 8)Manufacturing 9)Media and Information services 10) Retail and Consumer products 11) Telecom and 12) Travel, transport and hospitality]
# 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
[ Tips: The correct answer is Leading Change, Integrity, Respect for individual, Excellence, Learning and Sharing] 
# 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
[ Tips: The correct answer is Tata Research Development and Design Center (TRDDC)] 
# Question 5 of 10 10.0 Points
What was TCS’s 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
[ Tips: The correct answer is Institutional Group and Information Company (IGIC). The company pioneered the global delivery model for IT services with its first offshore client in 1974. TCS’s first international order came from Burroughs, one of the first business computer manufacturers. TCS was assigned to write code for the Burroughs machines for several US-based clients. This experience also helped TCS bag its first onsite project – the Institutional Group and Information Company (IGIC), a data centre for ten banks, which catered to two million customers in the US, assigned TCS the task of maintaining and upgrading its computer systems.]
# 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 India’s private sector’s largest initial public offer in
A. 2006 
B. 1999 
C. 2004 
D. 2002 

Answer Key: C 

TCS ASPIRE | Database management system quiz/question | latest 2016 - 2017

# 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