Citibank
10+ Interview Questions and Answers
Q1. 6. What is difference between procedure and function
Procedure is a set of instructions that performs a specific task, while function returns a value after performing a task.
Procedure does not return a value, while function does.
Functions can be called from within expressions, while procedures cannot.
Functions can have parameters passed to them, while procedures can have both parameters and arguments.
Examples of procedures include printing to the console, while examples of functions include calculating a sum or finding the leng...read more
Q2. 10. What is difference between soft link and hard link
Soft links are pointers to the original file while hard links are additional names for the same file.
Soft links are created using the 'ln -s' command while hard links are created using the 'ln' command.
Soft links can point to files on different file systems while hard links cannot.
Deleting the original file will render a soft link useless while a hard link will still work.
Soft links have different inode numbers while hard links have the same inode number as the original file.
Q3. 2. How to replace male with female in Oracle
To replace male with female in Oracle, use the UPDATE statement with the SET clause.
Use the UPDATE statement with the SET clause to replace male with female in Oracle
Example: UPDATE employees SET gender='female' WHERE gender='male'
Make sure to specify the table name and column name correctly
Use WHERE clause to specify the condition for replacement
Q4. 4.what is difference between delete and truncate
Delete removes specific rows while truncate removes all rows from a table.
Delete is a DML command while truncate is a DDL command.
Delete is slower than truncate as it logs each row deletion while truncate does not.
Delete can be rolled back while truncate cannot be rolled back.
Delete can have a WHERE clause to specify which rows to delete while truncate removes all rows.
Delete does not reset the identity of the table while truncate resets the identity of the table.
Q5. 8. Write command to replace Sam with vam on 5th line
Command to replace Sam with vam on 5th line
sed '5s/Sam/vam/' filename.txt
awk 'NR==5 {sub(/Sam/, "vam")} 1' filename.txt
Q6. 5.what is cursor and explain type of cursor
A cursor is a database object used to manipulate data in a result set.
A cursor is used to traverse through a result set one row at a time.
There are two types of cursors: static and dynamic.
Static cursors are read-only and scroll forward only.
Dynamic cursors are updatable and can scroll in any direction.
Cursors can be used in stored procedures, triggers, and functions.
Q7. 11. write command to display biggest file on server
Use the 'du' command to display biggest file on server.
Open terminal or SSH into server
Navigate to directory to search from
Run 'du -a . | sort -n -r | head -n 1' command
The output will display the biggest file on the server
Q8. 3.write to query to display 3rd highest salary
Query to display 3rd highest salary
Use the ORDER BY clause to sort the salaries in descending order
Use the LIMIT clause to limit the result to the third row
Use a subquery to exclude the top two salaries
Q9. 7.write command to display secod last line of file
Display second last line of a file using command line.
Use the tail command with -n option to display last two lines of the file.
Then use head command with -n option to display the second last line.
Example: tail -n 2 file.txt | head -n 1
Q10. 9. Write command to display blank line in file
Command to display blank line in file
Use echo command with empty quotes to create a blank line in a file
Syntax: echo '' >> filename
Alternatively, use printf command with newline character
Syntax: printf ' ' >> filename
Top Officer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month