GenC

100+ GenC Interview Questions and Answers

Updated 10 Nov 2024

Q1. A train travelling at a speed of 75 mph enters a tunnel 31/2 miles long. The train is 1/4 mile long. How long does it take for the train to pass through the tunnel from the moment the front enters to the moment...

read more
Ans.

Calculate the time taken by a train to pass through a tunnel given its speed, length, and the tunnel's length.

  • Convert the speed of the train from mph to miles per minute.

  • Calculate the time taken by the front of the train to enter the tunnel.

  • Calculate the time taken by the rear of the train to exit the tunnel.

  • Subtract the time taken by the front from the time taken by the rear to get the total time taken.

  • Add the units to the final answer.

Q2. What are different type of data structures and explain any 2 of them?

Ans.

Data structures are ways to organize and store data. Two examples are arrays and linked lists.

  • Arrays are a collection of elements of the same data type, stored in contiguous memory locations.

  • Linked lists are a collection of nodes, each containing data and a reference to the next node in the list.

GenC Interview Questions and Answers for Freshers

illustration image

Q3. What is a function and it's uses?

Ans.

A function is a block of code that performs a specific task and can be called multiple times.

  • Functions help in modularizing code and making it reusable.

  • Functions can take parameters and return values.

  • Functions can be defined in different ways such as function declaration, function expression, arrow function, etc.

  • Examples of functions include Math.max(), console.log(), and document.getElementById().

Q4. What are different types of algorthim methods in machine learning?

Ans.

There are various algorithm methods in machine learning, such as supervised learning, unsupervised learning, and reinforcement learning.

  • Supervised learning: Algorithms learn from labeled data to make predictions or classifications.

  • Unsupervised learning: Algorithms learn from unlabeled data to discover patterns or relationships.

  • Reinforcement learning: Algorithms learn through trial and error to maximize rewards.

  • Other methods include semi-supervised learning, transfer learning,...read more

Are these interview questions helpful?

Q5. What is ment by the term void?

Ans.

Void refers to a state of emptiness or absence of something.

  • It can refer to a physical space that is empty or without matter.

  • It can also refer to a lack of something, such as a void in one's life or a void in a contract.

  • In programming, void is a data type used to indicate that a function does not return a value.

  • In law, a void contract is one that is not legally binding.

  • In physics, a vacuum is often referred to as a void.

Q6. What is a loop?

Ans.

A loop is a programming construct that repeats a set of instructions until a certain condition is met.

  • Loops are used to automate repetitive tasks in programming.

  • There are three types of loops: for, while, and do-while.

  • For example, a for loop can be used to iterate over an array and perform a certain action on each element.

  • A while loop can be used to repeat a set of instructions until a certain condition is no longer true.

  • A do-while loop is similar to a while loop, but it alwa...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Q7. Can you tell me about your Google Facilitator Ready program?

Ans.

Google Facilitator Ready program is a training program that equips individuals with skills to facilitate Google's workshops and events.

  • The program provides training on how to facilitate Google's workshops and events

  • Participants learn how to create engaging content and deliver it effectively

  • The program also covers how to manage logistics and handle participant questions

  • Upon completion, participants receive a certificate and are eligible to facilitate Google's events

  • Examples of...read more

Q8. What is ment by machine learning?

Ans.

Machine learning is a subset of artificial intelligence that enables machines to learn from data and improve their performance.

  • Machine learning involves training algorithms to make predictions or decisions based on data.

  • It uses statistical techniques to identify patterns in data and make predictions.

  • Examples include image recognition, speech recognition, and recommendation systems.

  • Machine learning can be supervised, unsupervised, or semi-supervised.

  • It is used in various indus...read more

GenC Jobs

Urgent Walk-in Drive | Agency Health | Karnal | 19th Dec 0-5 years
Tata AIG General Insurance Company
4.1
₹ 3 L/yr - ₹ 5 L/yr
Karnal
Market Intelligence Lead - (WFO -HYD) 2-4 years
Nxtwave Disruptive Technologies
4.0
₹ 15 L/yr - ₹ 20 L/yr
Hyderabad / Secunderabad
Agency Channel - Health Insurance 3-8 years
Harjai Computers
3.8
₹ 1 L/yr - ₹ 5 L/yr
Noida

Q9. What is the difference between a primary key and a foreign key?

Ans.

Primary key uniquely identifies a record in a table, while foreign key refers to a field in another table.

  • Primary key is used to enforce data integrity and ensure uniqueness of records.

  • Foreign key is used to establish a relationship between two tables.

  • A table can have only one primary key, but multiple foreign keys.

  • Example: CustomerID in Orders table is a foreign key that references the Customer table's primary key.

  • Primary key is denoted by a key symbol, while foreign key is ...read more

Q10. Differentiate between supervised and unsupervised machine learning?

Ans.

Supervised learning uses labeled data to train models while unsupervised learning uses unlabeled data.

  • Supervised learning requires a target variable to be predicted while unsupervised learning does not.

  • Supervised learning algorithms include regression, classification, and decision trees while unsupervised learning algorithms include clustering and association.

  • Examples of supervised learning include predicting housing prices and classifying emails as spam or not, while example...read more

Q11. What are the data structures?

Ans.

Data structures are ways of organizing and storing data in a computer so that it can be accessed and used efficiently.

  • Data structures can be linear or non-linear

  • Examples of linear data structures include arrays, linked lists, and stacks

  • Examples of non-linear data structures include trees and graphs

  • Choosing the right data structure is important for efficient algorithm design

Q12. What are the latest technologies you have heard of?

Ans.

The latest technologies include AI, blockchain, 5G, quantum computing, and IoT.

  • AI - machine learning, natural language processing

  • Blockchain - decentralized ledgers, smart contracts

  • 5G - faster internet speeds, low latency

  • Quantum computing - exponential processing power

  • IoT - interconnected devices, data collection

Q13. What are the four Pillars of OOPS?

Ans.

The four pillars of OOPS are Abstraction, Encapsulation, Inheritance, and Polymorphism.

  • Abstraction: Hiding implementation details and showing only necessary information.

  • Encapsulation: Binding data and functions together and restricting access to them.

  • Inheritance: Creating new classes from existing ones, inheriting properties and methods.

  • Polymorphism: Ability of objects to take on multiple forms or behaviors.

Q14. What is the difference between instance and local variable?

Ans.

Instance variables are declared in a class and can be accessed by any method in the class. Local variables are declared in a method and can only be accessed within that method.

  • Instance variables are declared at the class level, while local variables are declared within a method.

  • Instance variables can be accessed by any method in the class, while local variables can only be accessed within the method they are declared in.

  • Instance variables are initialized to default values, wh...read more

Q15. Statements P: Some mobiles are cameras. Q: Some cameras are calculators. Conclusions I. All calculators are mobiles. II. All cameras are mobiles

Ans.

The conclusions cannot be determined from the given statements.

  • Statement P and Q do not have a direct relationship.

  • There is no information given about the relationship between calculators and cameras.

  • Therefore, neither conclusion can be drawn.

Q16. In which programming language you are comfortable?

Ans.

I am comfortable in multiple programming languages including Python, Java, and C++.

  • Python

  • Java

  • C++

Q17. If suddenly the python language was made obsolete and Java was the main programing language suddenly, how would you cope up with this change?

Ans.

I would adapt by learning Java and leveraging my programming skills to transition smoothly.

  • I would start by taking online courses or tutorials to quickly learn Java syntax and best practices.

  • I would also seek guidance from colleagues or mentors who are experienced in Java programming.

  • I would practice coding in Java by working on small projects or contributing to open source projects.

  • I would stay updated on Java trends and advancements to ensure I am proficient in the language...read more

Q18. What are the different data types in python?

Ans.

Python has several built-in data types including numeric, sequence, and mapping types.

  • Numeric types include integers, floats, and complex numbers.

  • Sequence types include lists, tuples, and strings.

  • Mapping types include dictionaries.

  • Boolean type is also available.

  • Type() function can be used to determine the data type of a variable.

Q19. what is the difference between while and do while?

Ans.

while loop checks condition before executing, do while loop executes at least once before checking condition.

  • while loop is entry controlled loop, do while loop is exit controlled loop

  • while loop may not execute at all if condition is false initially, do while loop executes at least once

  • while loop syntax: while(condition){ //code to execute }

  • do while loop syntax: do{ //code to execute }while(condition);

Q20. What are the different types of Joins in SQL?

Ans.

There are four types of Joins in SQL: Inner Join, Left Join, Right Join, and Full Outer Join.

  • Inner Join returns only the matching rows from both tables.

  • Left Join returns all the rows from the left table and matching rows from the right table.

  • Right Join returns all the rows from the right table and matching rows from the left table.

  • Full Outer Join returns all the rows from both tables, with NULL values in the columns where there is no match.

  • Examples: SELECT * FROM table1 INNER...read more

Q21. Statements P: Some bags are hot. Q: All hots are cakes. Conclusions I. All cakes are bags. II. Some bags are cakes.

Ans.

Conclusion II follows from the given statements.

  • Statement P and Q do not provide enough information to conclude that all cakes are bags.

  • However, it can be concluded that some bags are cakes as some bags are hot and all hots are cakes.

  • Therefore, Conclusion II is true while Conclusion I is false.

Q22. What is the difference between C and C++?

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has better support for polymorphism and inheritance.

  • C++ has a standard template library (STL) for data structures and algorithms.

  • C++ allows function overloading and default arguments.

  • C++ has exception handling for error management.

  • C++ is more complex and has a steeper learning curve than C.

Frequently asked in, ,

Q23. Which is the most comfortable programming language for you?

Ans.

Python is the most comfortable programming language for me.

  • Python has a simple and easy-to-learn syntax.

  • It has a vast collection of libraries and frameworks.

  • Python is versatile and can be used for various applications such as web development, data analysis, and machine learning.

  • Python has a large community that provides support and resources.

  • Examples: Flask, Django, NumPy, Pandas, TensorFlow.

Q24. Simple SQL query to find duplicate items in a database.

Ans.

SQL query to find duplicate items in a database.

  • Use GROUP BY clause to group the items by their values

  • Use HAVING clause to filter out groups with count greater than 1

  • Select the columns you want to display in the result

Q25. What do you know about Cognizant?

Ans.

Cognizant is a multinational technology company providing digital, technology, consulting, and operations services.

  • Founded in 1994 and headquartered in Teaneck, New Jersey

  • Has a global presence with operations in over 40 countries

  • Offers services in areas such as artificial intelligence, cloud computing, and cybersecurity

  • Works with clients across various industries including healthcare, finance, and retail

  • Has over 300,000 employees worldwide

Q26. Write a program for reverse string?

Ans.

A program to reverse a given string.

  • Create an empty string to store the reversed string

  • Loop through the original string from the end to the beginning

  • Add each character to the new string

  • Return the new string

Q27. what is c,c++,difference between c and c++

Ans.

C and C++ are programming languages. C++ is an extension of C with additional features.

  • C is a procedural language while C++ is an object-oriented language.

  • C++ supports features like classes, inheritance, and polymorphism which are not present in C.

  • C++ also has better support for templates and exception handling compared to C.

  • C++ code can also be written in a more modular and reusable way compared to C.

  • C++ is often used for developing complex software systems like operating sy...read more

Q28. Write a code to print first 10 element of Fibonacci series.

Ans.

Code to print first 10 elements of Fibonacci series.

  • Declare variables for first two numbers of the series

  • Use a loop to generate the next numbers in the series

  • Print the first 10 numbers of the series

Q29. Why does Java have no pointers?

Ans.

Java has no pointers for safety reasons and to simplify memory management.

  • Java uses references instead of pointers to avoid security vulnerabilities.

  • Pointers can cause memory leaks and dangling references, which Java avoids.

  • Java's garbage collector automatically manages memory, making pointers unnecessary.

  • Example: Java's NullPointerException is a result of using a null reference, not a pointer.

  • Example: C++ allows pointer arithmetic, which can lead to buffer overflows and othe...read more

Q30. Is python is case sensitive?what are decorators in python?

Ans.

Yes, Python is case sensitive. Decorators are functions that modify the behavior of other functions.

  • Python is case sensitive, meaning that 'hello' and 'Hello' are two different variables

  • Decorators are functions that take another function as input and extend its functionality

  • They are denoted by the '@' symbol and placed above the function definition

  • Example: @decorator_function def my_function(): # code here

  • Common decorators include @staticmethod, @classmethod, and @property

Q31. Code for recursion function,what is the samllest product of 10 whole number

Ans.

Recursion function code and finding smallest product of 10 whole numbers.

  • Recursion function code: function recursion(num) { if(num === 0) { return 1; } else { return num * recursion(num-1); } }

  • To find smallest product of 10 whole numbers, we can multiply the smallest 5 negative numbers with the smallest 5 positive numbers.

  • Example: [-5, -4, -3, -2, -1, 1, 2, 3, 4, 5] => (-5) * (-4) * (-3) * (-2) * (-1) * 1 * 2 * 3 * 4 * 5 = -1200

Q32. Why java is platform independent?

Ans.

Java is platform independent because it uses the concept of bytecode and virtual machine.

  • Java programs are compiled into bytecode, which is a platform-independent representation of the code.

  • The bytecode is then executed by the Java Virtual Machine (JVM), which is specific to each platform.

  • The JVM interprets the bytecode and translates it into machine code that can be understood by the underlying operating system.

  • This allows Java programs to run on any platform that has a comp...read more

Q33. write a coding for given year is leap or not

Ans.

Coding to check if a given year is leap or not

  • A year is a leap year if it is divisible by 4 but not by 100, or if it is divisible by 400

  • Use modulo operator to check if the year is divisible by 4, 100, and 400

  • Return true if the year is divisible by 4 and not by 100, or if it is divisible by 400. Else, return false

Q34. How to create an empty class?

Ans.

An empty class can be created by simply declaring a class with no properties or methods.

  • Declare a class with no properties or methods

  • Example: class EmptyClass {}

  • The class can be used as a placeholder for future implementation

Q35. What is constructor overloading?

Ans.

Constructor overloading is the ability to have multiple constructors with different parameters in a class.

  • Constructor overloading allows creating objects with different initializations.

  • It helps in providing flexibility and convenience to the users of the class.

  • Constructors can be overloaded by changing the number, type, or order of parameters.

  • Example: class Person { Person() {} Person(String name) {} }

Q36. What is prefix notation? Write one example.

Ans.

Prefix notation is a way of writing mathematical expressions where the operator comes before the operands.

  • Also known as Polish notation

  • Example: + 2 3 is equivalent to 2 + 3

  • Useful in computer science for evaluating expressions

  • Requires less parentheses than infix notation

Q37. write a code to connect database in python

Ans.

Code to connect database in Python

  • Import the required module (e.g. pymysql, sqlite3)

  • Establish a connection to the database using connect() method

  • Create a cursor object using cursor() method

  • Execute SQL queries using execute() method

  • Commit changes using commit() method

  • Close the cursor and connection using close() method

Q38. WAP to get 3rd largest odd number in an array?

Ans.

Find the 3rd largest odd number in an array of strings.

  • Convert the array of strings to an array of integers.

  • Filter out the odd numbers from the array.

  • Sort the odd numbers in descending order.

  • Return the 3rd element from the sorted array.

Q39. What is HTML?

Ans.

HTML stands for Hypertext Markup Language. It is the standard markup language used to create web pages.

  • HTML is used to structure content on the web

  • It uses tags to define elements such as headings, paragraphs, and links

  • It can also include multimedia elements such as images and videos

  • HTML is the backbone of the web and is essential for creating websites and web applications

Q40. Do you have any backlogs?

Ans.

No, I do not have any backlogs.

  • I have successfully completed all my courses and exams.

  • I have maintained a good academic record throughout.

  • I have never had to repeat a course or exam.

  • I have always been diligent in my studies and time management.

Q41. what are the features of oops?

Ans.

Object-oriented programming features include encapsulation, inheritance, polymorphism, and abstraction.

  • Encapsulation: bundling of data and methods that manipulate the data

  • Inheritance: creating new classes from existing ones

  • Polymorphism: ability of objects to take on multiple forms

  • Abstraction: hiding implementation details from users

Q42. What is cloud computing?

Ans.

Cloud computing is the delivery of computing services over the internet.

  • Cloud computing allows users to access data and applications from anywhere with an internet connection.

  • It offers scalability, flexibility, and cost-effectiveness compared to traditional on-premises computing.

  • Examples include Amazon Web Services, Microsoft Azure, and Google Cloud Platform.

Frequently asked in, ,

Q43. What are OOPS concepts?

Ans.

OOPS concepts are the fundamental principles of Object-Oriented Programming that help in designing and implementing software systems.

  • Encapsulation: Bundling data and methods together in a class.

  • Inheritance: Creating new classes from existing ones, inheriting their properties and behaviors.

  • Polymorphism: Objects of different classes can be treated as objects of a common superclass.

  • Abstraction: Hiding complex implementation details and providing simplified interfaces.

  • Encapsulati...read more

Frequently asked in, ,

Q44. Explain polymorphism, inheritance and OOPS.

Ans.

Polymorphism, inheritance and OOPS are concepts in object-oriented programming.

  • Polymorphism allows objects of different classes to be treated as if they are of the same class.

  • Inheritance allows a class to inherit properties and methods from another class.

  • OOPS is a programming paradigm that uses objects to represent real-world entities and their interactions.

  • Example of polymorphism: A shape class with different subclasses like circle, square, and triangle.

  • Example of inheritanc...read more

Q45. What's the difference between list and tuple?

Ans.

List is mutable while tuple is immutable.

  • Lists can be modified while tuples cannot

  • Lists use square brackets [] while tuples use parentheses ()

  • Lists are used for collections of data that can be changed while tuples are used for fixed collections of data

  • Lists are slower than tuples

  • Example: list = [1, 2, 3], tuple = (1, 2, 3)

Q46. Difference between list and tuple?

Ans.

List is mutable and tuple is immutable in Python.

  • Lists can be modified while tuples cannot be modified once created.

  • Lists are defined using square brackets while tuples are defined using parentheses.

  • Lists are used for collections of homogeneous items while tuples are used for heterogeneous items.

  • Lists are slower than tuples in terms of performance.

  • Example of list: my_list = [1, 2, 3]

  • Example of tuple: my_tuple = (1, 'hello', 3.14)

Frequently asked in, ,

Q47. What is JVM?

Ans.

JVM stands for Java Virtual Machine. It is an abstract machine that enables a computer to run Java programs.

  • JVM is responsible for interpreting the compiled Java code and executing it on the computer.

  • It provides a platform-independent environment for Java programs to run on different operating systems.

  • JVM has various components such as Class Loader, Bytecode Verifier, Just-In-Time Compiler, and Garbage Collector.

  • Examples of JVM-based languages include Java, Kotlin, and Scala.

Frequently asked in,

Q48. Which programming language do you know?

Ans.

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

  • Proficient in Java, Python, and C++

  • Familiar with JavaScript, HTML, and CSS

  • Experience with SQL and NoSQL databases

Frequently asked in,

Q49. what error do you get if you break immutablity?

Ans.

Attempting to modify an immutable object will result in a compilation error or runtime exception.

  • Attempting to modify a string literal will result in a compilation error.

  • Trying to modify elements of an immutable list like ImmutableList in Java will throw an UnsupportedOperationException.

  • Modifying a frozen set in Python will raise a TypeError.

Q50. State the differences between C and C++.

Ans.

C++ is an extension of C with object-oriented programming features.

  • C++ supports classes and objects while C does not.

  • C++ has constructors and destructors while C does not.

  • C++ supports function overloading while C does not.

  • C++ has namespaces while C does not.

  • C++ supports exception handling while C does not.

1
2
3
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.8
 • 5.4k Interviews
3.8
 • 191 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

GenC Interview Questions
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
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

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