Add office photos
Engaged Employer

Amdocs

3.8
based on 3.9k Reviews
Filter interviews by

60+ Semco Maritime Interview Questions and Answers

Updated 13 Sep 2024
Popular Designations

Q1. Maximum Sum Increasing Subsequence of Length K Problem Statement

You are given an array NUMS consisting of N integers and an integer K. Your task is to determine the maximum sum of an increasing subsequence of ...read more

Add your answer

Q2. First Unique Character in a String Problem Statement

Given a string STR consisting of lowercase English letters, identify the first non-repeating character in the string and return it. If no such character exis...read more

Add your answer

Q3. Implement Atoi Function

You have a string 'STR' of length 'N'. Your task is to implement the atoi function, which converts the string into an integer. If the string does not contain any numbers, the function sh...read more

Add your answer

Q4. Subarray with Equal Occurrences Problem Statement

You are provided with an array/list ARR of length N containing only 0s and 1s. Your goal is to determine the number of non-empty subarrays where the number of 0...read more

Add your answer
Discover Semco Maritime interview dos and don'ts from real experiences

Q5. Palindrome String Validation

Determine if a given string 'S' is a palindrome, considering only alphanumeric characters and ignoring spaces and symbols.

Note:
The string 'S' should be evaluated in a case-insensi...read more
Add your answer

Q6. Pythagorean Triplets Detection

Determine if an array contains a Pythagorean triplet by checking whether there are three integers x, y, and z such that x2 + y2 = z2 within the array.

Input:

The first line contai...read more
Add your answer
Are these interview questions helpful?

Q7. Fibonacci Number Verification

Identify if the provided integer 'N' is a Fibonacci number.

A number is termed as a Fibonacci number if it appears in the Fibonacci sequence, where each number is the sum of the tw...read more

Add your answer

Q8. K - Sum Path In A Binary Tree

Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in each p...read more

Add your answer
Share interview questions and help millions of jobseekers 🌟

Q9. Nth Fibonacci Number Problem Statement

Calculate the Nth term in the Fibonacci sequence, where the sequence is defined as follows: F(n) = F(n-1) + F(n-2), with initial conditions F(1) = F(2) = 1.

Input:

The inp...read more
Add your answer

Q10. All Prime Numbers Problem Statement

Given an integer 'N', your task is to print all the prime numbers that lie within the range from 2 to 'N' (inclusive).

Input:

Integer N

Output:

Prime numbers printed on separ...read more
Add your answer

Q11. Reverse Stack with Recursion

Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you must r...read more

Add your answer

Q12. Nth Fibonacci Number Problem

Calculate the Nth term in the Fibonacci sequence using the formula: F(n) = F(n-1) + F(n-2) where F(1) = F(2) = 1.

Given a number N, determine the Nth Fibonacci number.

Input:

N

Outp...read more

Add your answer

Q13. Priority Queue Implementation

Ninja is tasked with implementing a priority queue using the Heap data structure. Since Ninja is busy with tournament preparations, your help is requested to complete this task.

Pr...read more

Add your answer

Q14. What is right outer join and it's use in real world scenario

Ans.

Right outer join is a type of join operation that returns all the rows from the right table and the matching rows from the left table.

  • Right outer join is denoted by the RIGHT JOIN keyword in SQL.

  • It is used to combine rows from two tables based on a related column.

  • In the result set, unmatched rows from the right table will have NULL values for the columns of the left table.

  • A real-world scenario for using a right outer join is when analyzing customer data and sales data. The ri...read more

Add your answer

Q15. How to convert a string containing a number into integer without using inbuilt function?

Ans.

Convert string to integer without using inbuilt function

  • Iterate through each character and multiply by 10 and add the integer value of the character

  • Use ASCII values to convert character to integer

  • Handle negative numbers separately

Add your answer
Q16. What is a friend function in C++?
Add your answer
Q17. What is meant by normalization and denormalization?
Add your answer
Q18. Can you write a SQL query that joins two tables A and B on the common attribute ID and selects records (ID_NAME) that have matching ID values in both tables?
Add your answer
Q19. What is the garbage collector in Java?
Add your answer
Q20. Can you explain any 5 essential UNIX commands?
Add your answer

Q21. What is recursion?Explain it graphically?How compiler executed recursion?

Ans.

Recursion is a process in which a function calls itself repeatedly until a base condition is met.

  • Recursion involves breaking down a problem into smaller subproblems and solving them recursively.

  • It uses a stack to keep track of function calls and their parameters.

  • Examples include factorial, Fibonacci sequence, and binary search.

  • Compiler executes recursion by allocating memory for each function call and storing the return address and local variables on the stack.

  • It then pops th...read more

Add your answer
Q22. What is a static variable in C?
Add your answer
Q23. Can you explain run time polymorphism in C++?
Add your answer
Q24. Can you explain the concepts of Left Outer Join and Right Outer Join in DBMS?
Add your answer

Q25. What is python and constructer ,arrays,data structures

Ans.

Python is a high-level programming language known for its simplicity and readability. Constructors are special methods used to initialize objects in classes.

  • Python is a versatile programming language used for web development, data analysis, artificial intelligence, and more.

  • Constructors in Python are special methods with the __init__() function that initialize objects when they are created.

  • Arrays in Python are data structures that can hold multiple values of the same type. Th...read more

Add your answer

Q26. Swap two character variables without using third

Ans.

Swapping two character variables without using third

  • Use XOR operator to swap two variables without using third variable

  • Assign the XOR of both variables to the first variable

  • Assign the XOR of the first variable and second variable to the second variable

View 1 answer
Q27. What is the difference between a primary key and a unique key in a database management system?
Add your answer
Q28. You have 3 bulbs outside a room and 3 switches inside the room. The challenge is to determine which switch controls which bulb, with the constraint that you can only enter the bulb room once.
Add your answer

Q29. Write any program of recursion and explain it using stack frames?

Ans.

A program demonstrating recursion using factorial function.

  • Recursion is a technique where a function calls itself.

  • Factorial function is a classic example of recursion.

  • Each recursive call creates a new stack frame.

  • The base case is when the input is 1, and the function returns 1.

  • The final result is the product of all the recursive calls.

  • Example: factorial(5) = 5 * factorial(4) = 5 * 4 * factorial(3) = ... = 5 * 4 * 3 * 2 * 1 = 120.

Add your answer
Q30. Can you explain the Singleton Class in Java?
Add your answer

Q31. Difference between Primary key and Unique key

Ans.

Primary key uniquely identifies a record in a table, while Unique key ensures uniqueness of a column.

  • Primary key can't have null values, Unique key can have one null value

  • A table can have only one Primary key, but multiple Unique keys

  • Primary key is automatically indexed, Unique key is not necessarily indexed

View 1 answer

Q32. which data structure is used in recursion?

Ans.

The data structure used in recursion is a stack.

  • Recursion uses a stack data structure to keep track of function calls.

  • Each time a function is called, its parameters and local variables are pushed onto the stack.

  • When the function returns, the values are popped off the stack.

  • This allows the program to keep track of where it is in the recursive process.

  • Examples of recursive algorithms that use a stack include depth-first search and quicksort.

Add your answer
Q33. How do you find the second highest salary in a table?
Add your answer

Q34. Write a program to check string is pallindrome or not

Ans.

Program to check if a string is a palindrome or not.

  • Remove all spaces and convert to lowercase for case-insensitive comparison.

  • Compare the first and last characters, then move towards the center until all characters have been compared.

  • If all characters match, the string is a palindrome.

  • If any characters do not match, the string is not a palindrome.

Add your answer

Q35. What is a friend function

Ans.

A friend function is a non-member function that has access to the private and protected members of a class.

  • Declared inside the class but defined outside the class scope

  • Can access private and protected members of the class

  • Not a member of the class but has access to its private members

  • Used to allow external functions to access and modify private data of a class

  • Can be declared as a friend in another class

Add your answer

Q36. What is garbage collection in java

Ans.

Garbage collection in Java is an automatic memory management process.

  • It frees up memory by removing objects that are no longer in use.

  • It is performed by the JVM in the background.

  • It helps prevent memory leaks and improves performance.

  • There are different types of garbage collectors in Java, such as Serial, Parallel, CMS, and G1.

  • Example: int[] arr = new int[1000]; arr = null; // Garbage collector will remove the array from memory

Add your answer

Q37. Addition and Deletion of a node in binary tree?

Ans.

Addition and Deletion of a node in binary tree

  • For addition, traverse the tree to find the appropriate position and add the new node as a leaf

  • For deletion, find the node to be deleted and replace it with its successor or predecessor

  • In case of deletion, if the node has two children, find the inorder successor and replace it with the node to be deleted

Add your answer
Q38. How can you measure exactly 4 liters of water using only a 3-liter can and a 5-liter can?
Add your answer

Q39. Definition of atoi function of C

Ans.

atoi function converts a string to an integer in C.

  • The function takes a string as input and returns an integer.

  • Leading white spaces are ignored.

  • If the string contains non-numeric characters, the function stops conversion and returns the converted value.

  • The function returns 0 if the input string is not a valid integer.

  • Example: atoi('123') returns 123.

Add your answer

Q40. A program to print star pattern

Ans.

A program to print star pattern

  • Use nested loops to print the pattern

  • The outer loop controls the number of rows

  • The inner loop controls the number of stars to be printed in each row

  • Use print() or println() function to print the stars

Add your answer
Q41. You have a racetrack with 25 horses. What is the fastest way to determine the top 3 fastest horses, given that you can only race 5 horses at a time?
Add your answer

Q42. What is refrential integrity

Ans.

Refrential integrity ensures that relationships between tables in a database remain consistent.

  • It is a database concept that ensures that foreign key values in one table match the primary key values in another table.

  • It prevents orphaned records in a database.

  • It maintains data consistency and accuracy.

  • For example, if a customer record is deleted, all related orders for that customer should also be deleted.

  • It is enforced through constraints such as foreign key constraints.

Add your answer

Q43. 2.what is singleton pattern

Ans.

Singleton pattern is a design pattern that restricts the instantiation of a class to one object.

  • Used when only one instance of a class is needed throughout the application

  • Provides a global point of access to the instance

  • Implemented using a private constructor and a static method to return the instance

  • Example: Database connection, Logger, Configuration settings

Add your answer

Q44. Real time examples of Data structures?

Ans.

Data structures are used to organize and store data in a computer program.

  • Arrays - used to store a collection of elements of the same data type

  • Linked Lists - used to store a collection of elements where each element points to the next element

  • Stacks - used to store a collection of elements where the last element added is the first element removed

  • Queues - used to store a collection of elements where the first element added is the first element removed

  • Trees - used to store hiera...read more

Add your answer

Q45. Which programming languages do you know.

Ans.

I know multiple programming languages including Java, Python, and C++.

  • Java

  • Python

  • C++

Add your answer

Q46. 3.what is static variable

Ans.

Static variable is a variable that retains its value even after the function execution is completed.

  • Declared with static keyword

  • Memory is allocated once and shared among all instances of the class or function

  • Can be accessed without creating an object of the class

Add your answer

Q47. Triggers and their types

Ans.

Triggers are database objects that are automatically executed in response to certain events.

  • Triggers can be used to enforce business rules, audit changes, or replicate data.

  • There are two types of triggers: DML triggers and DDL triggers.

  • DML triggers are fired in response to DML statements (INSERT, UPDATE, DELETE).

  • DDL triggers are fired in response to DDL statements (CREATE, ALTER, DROP).

Add your answer

Q48. Libraries and packages in python

Ans.

Libraries and packages in Python are reusable collections of code that provide functionality to perform specific tasks.

  • Libraries and packages help in reducing the amount of code that needs to be written from scratch

  • Popular libraries in Python include NumPy for numerical computing, Pandas for data manipulation, and Matplotlib for data visualization

  • Packages can be installed using package managers like pip or conda

Add your answer

Q49. Run time polymorphism in C++

Ans.

Run time polymorphism is the ability of a program to determine the object type at runtime and call the appropriate method.

  • It is achieved through virtual functions and dynamic binding.

  • Allows for more flexible and extensible code.

  • Example: a base class Animal with virtual function makeSound() and derived classes Dog and Cat that override makeSound().

  • At runtime, if an Animal pointer points to a Dog object, calling makeSound() will execute the Dog's implementation.

Add your answer

Q50. Five linux commands you know

Ans.

Five commonly used Linux commands

  • ls - list directory contents

  • cd - change directory

  • mkdir - make directory

  • rm - remove files or directories

  • grep - search for a pattern in a file

Add your answer

Q51. Write a query for delete

Ans.

Query for deleting data from a database table.

  • Use the DELETE statement followed by the table name.

  • Add a WHERE clause to specify the condition for deleting specific rows.

  • Be careful when deleting data as it cannot be recovered.

  • Example: DELETE FROM customers WHERE customer_id = 1234;

View 1 answer

Q52. Explain time complexity

Ans.

Time complexity refers to the amount of time taken by an algorithm to run as the input size increases.

  • It measures the efficiency of an algorithm.

  • It is usually expressed in Big O notation.

  • An algorithm with a lower time complexity is more efficient than one with a higher time complexity.

Add your answer

Q53. Count the number of vowels in a string

Ans.

Count the number of vowels in a given string

  • Iterate through each character in the string and check if it is a vowel (a, e, i, o, u)

  • Maintain a count of vowels encountered

  • Return the total count of vowels in the string

Add your answer

Q54. Write a code for copy constructor

Ans.

A copy constructor is a special type of constructor which creates a new object as a copy of an existing object.

  • Ensure the copy constructor has the same signature as the default constructor.

  • Allocate memory for the new object and copy the values from the existing object.

  • Handle deep copy vs shallow copy based on the object's data types.

Add your answer

Q55. What is a copy constructor

Ans.

A copy constructor is a special type of constructor in object-oriented programming that creates a new object as a copy of an existing object.

  • Creates a new object by copying the attributes of an existing object

  • Used to initialize a new object with the values of an existing object

  • Helps in creating deep copies of objects to avoid shallow copy issues

Add your answer

Q56. Explain Oops in java?

Ans.

Object-oriented programming paradigm in Java focusing on objects and classes.

  • OOPs stands for Object-Oriented Programming.

  • It focuses on creating objects that interact with each other through classes.

  • Key principles include Inheritance, Encapsulation, Polymorphism, and Abstraction.

  • Example: Class Car { String color; void start() { //code here } }

  • Example: Car myCar = new Car(); myCar.color = 'red'; myCar.start();

Add your answer

Q57. Collection framework in java?

Ans.

Collection framework in Java provides a set of interfaces and classes to store and manipulate groups of objects.

  • Includes interfaces like List, Set, and Map

  • Classes like ArrayList, LinkedList, HashSet, and HashMap implement these interfaces

  • Provides methods for adding, removing, and accessing elements in collections

Add your answer

Q58. 1. CountingSubstring in array

Ans.

Count the number of occurrences of a specific substring in an array of strings.

  • Iterate through each string in the array and use a function to count occurrences of the substring.

  • Use a loop to go through each character in the string and check for matches with the substring.

  • Keep a count variable to track the number of occurrences found.

Add your answer

Q59. joins and their use.

Ans.

Joins are used in databases to combine rows from two or more tables based on a related column between them.

  • Joins are used to retrieve data from multiple tables based on a related column.

  • Common types of joins include INNER JOIN, LEFT JOIN, RIGHT JOIN, and FULL JOIN.

  • INNER JOIN returns rows when there is at least one match in both tables.

  • LEFT JOIN returns all rows from the left table and the matched rows from the right table.

  • RIGHT JOIN returns all rows from the right table and t...read more

Add your answer

Q60. Detect cycle in LinkedList

Ans.

Detect cycle in LinkedList by using Floyd's Tortoise and Hare algorithm.

  • Use two pointers, slow and fast, to traverse the LinkedList.

  • If there is a cycle, the fast pointer will eventually meet the slow pointer.

  • Initialize slow and fast pointers at the head of the LinkedList.

  • Move slow pointer by one step and fast pointer by two steps.

  • If fast pointer reaches the end of the LinkedList, there is no cycle.

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos

Interview Process at Semco Maritime

based on 35 interviews
4 Interview rounds
Coding Test Round
HR Round - 1
HR Round - 2
HR Round - 3
View more
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Top Associate Software Engineer Interview Questions from Similar Companies

3.5
 • 53 Interview Questions
3.4
 • 47 Interview Questions
3.4
 • 18 Interview Questions
3.8
 • 13 Interview Questions
View all
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
70 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter