GenC
40+ GenC Interview Questions and Answers for Freshers
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 moreCalculate 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. Can you tell me about your Google Facilitator Ready program?
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
Q3. What is the difference between a primary key and a foreign key?
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
Q4. What are the latest technologies you have heard of?
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
Q5. What are the four Pillars of OOPS?
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.
Q6. What is the difference between instance and local variable?
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
Share interview questions and help millions of jobseekers 🌟
Q7. Statements P: Some mobiles are cameras. Q: Some cameras are calculators. Conclusions I. All calculators are mobiles. II. All cameras are mobiles
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.
Q8. What are the different data types in python?
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.
GenC Jobs
Q9. what is the difference between while and do while?
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);
Q10. Statements P: Some bags are hot. Q: All hots are cakes. Conclusions I. All cakes are bags. II. Some bags are cakes.
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.
Q11. What is the difference between C and C++?
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.
Q12. Which is the most comfortable programming language for you?
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.
Q13. Simple SQL query to find duplicate items in a database.
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
Q14. What do you know about Cognizant?
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
Q15. Write a program for reverse string?
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
Q16. what is c,c++,difference between c and c++
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
Q17. Write a code to print first 10 element of Fibonacci series.
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
Q18. Why does Java have no pointers?
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
Q19. Why java is platform independent?
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
Q20. write a coding for given year is leap or not
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
Q21. How to create an empty class?
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
Q22. What is constructor overloading?
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) {} }
Q23. write a code to connect database in python
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
Q24. What is HTML?
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
Q25. Do you have any backlogs?
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.
Q26. what are the features of oops?
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
Q27. What is cloud computing?
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.
Q28. What are OOPS concepts?
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
Q29. Explain polymorphism, inheritance and OOPS.
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
Q30. Difference between list and tuple?
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)
Q31. What is JVM?
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.
Q32. State the differences between C and C++.
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.
Q33. Main Differences Between C++ and Java
C++ and Java are both object-oriented programming languages, but differ in syntax, memory management, and platform compatibility.
C++ supports multiple inheritance, while Java only supports single inheritance.
C++ allows direct memory manipulation, while Java has a garbage collector for automatic memory management.
C++ is closer to the hardware and provides more control, while Java is platform-independent and provides portability.
C++ has pointers, while Java uses references.
C++ ...read more
Q34. Define memory management in Python
Memory management in Python involves allocation and deallocation of memory for objects.
Python uses automatic memory management through garbage collection.
Memory is allocated dynamically as objects are created.
Unused memory is automatically deallocated through reference counting or garbage collection.
Python provides tools like sys.getsizeof() and tracemalloc to manage memory usage.
Memory leaks can occur if objects are not properly deallocated.
Q35. What is a database?
A database is a structured collection of data that is stored and organized for easy retrieval and manipulation.
A database is used to store and manage large amounts of data.
It allows for easy retrieval and manipulation of data.
Data is organized into tables, with each table containing related information.
Examples of databases include MySQL, Oracle, and MongoDB.
Q36. What is DBMS?
DBMS stands for Database Management System. It is a software that manages and organizes data in a structured manner.
DBMS is used to create, retrieve, update, and delete data in a database.
It provides a way to store and organize large amounts of data efficiently.
DBMS ensures data integrity, security, and concurrency control.
Examples of popular DBMS include MySQL, Oracle, SQL Server, and PostgreSQL.
Q37. What are loops?
Loops are programming structures that allow a set of instructions to be repeated multiple times.
Loops are used to iterate over arrays or perform a set of instructions a certain number of times.
There are three types of loops in most programming languages: for, while, and do-while.
Example: for (var i = 0; i < 10; i++) { console.log(i); }
Example: while (condition) { // code block }
Example: do { // code block } while (condition);
Q38. What is pointer?
A pointer is a variable that stores the memory address of another variable.
Pointers allow for dynamic memory allocation and manipulation.
They are commonly used in programming languages like C and C++.
Example: int *ptr; ptr = # *ptr = 10; // num now has a value of 10
Q39. Types of inheritance?
Types of inheritance include single, multiple, multilevel, hierarchical, hybrid, and multipath inheritance.
Single inheritance: a class inherits from a single base class.
Multiple inheritance: a class inherits from multiple base classes.
Multilevel inheritance: a class inherits from a derived class, which in turn inherits from another class.
Hierarchical inheritance: multiple classes inherit from a single base class.
Hybrid inheritance: a combination of multiple and multilevel inh...read more
Q40. What is pointers?
Pointers are variables that store memory addresses. They allow direct manipulation of memory and facilitate efficient memory management.
Pointers store memory addresses
They allow direct manipulation of memory
They facilitate efficient memory management
Q41. write a code that returns null
Code snippet to return null
In Java: return null;
In Python: return None
In C#: return null;
In JavaScript: return null;
Q42. difference between array and list.
Arrays are fixed in size and hold elements of the same data type, while lists are dynamic and can hold elements of different data types.
Arrays are declared with a fixed size, while lists can grow or shrink dynamically.
Arrays can only hold elements of the same data type, while lists can hold elements of different data types.
Arrays are accessed using an index, while lists are accessed using an iterator.
Examples: int[] arr = new int[5]; List
list = new ArrayList<>();
Q43. Example function overloading and overriding
Function overloading is having multiple functions with the same name but different parameters, while function overriding is redefining a function in a subclass.
Function overloading: Same function name but different parameters (e.g. sum(int a, int b) and sum(double a, double b)
Function overriding: Redefining a function in a subclass with the same name and parameters as in the superclass
Overloading is resolved at compile time, while overriding is resolved at runtime
Q44. Explain Inheritance
Inheritance is a concept in object-oriented programming where a class inherits properties and behaviors from another class.
Inheritance allows for code reuse and promotes the concept of hierarchy.
The class that is being inherited from is called the superclass or base class.
The class that inherits from the superclass is called the subclass or derived class.
The subclass can access the public and protected members of the superclass.
Inheritance can be single, where a subclass inhe...read more
Q45. program to print odd prime number?
A program to print odd prime numbers.
Start with a loop to iterate through all odd numbers
Check if the number is prime using a function
If the number is prime, print it
Q46. Explain inheritance with example
Inheritance is a concept in object-oriented programming where a class can inherit attributes and methods from another class.
Allows a class to inherit attributes and methods from another class
Promotes code reusability and reduces redundancy
Derived class can add its own attributes and methods or override existing ones
Example: Parent class 'Animal' with attributes 'name' and method 'eat', Child class 'Dog' inherits 'Animal' and adds attribute 'breed' and method 'bark'
Q47. define array?
An array is a collection of elements of the same data type, stored in contiguous memory locations.
Arrays can be of any data type, including integers, floats, and objects.
Arrays are accessed using an index, starting from 0.
Arrays can be initialized with a fixed size or dynamically resized.
Example: string[] names = {"John", "Jane", "Bob"};
Example: int[] numbers = new int[5];
Example: object[] objects = new object[3] {1, "hello", true};
Q48. define function?
A function is a block of code that performs a specific task and can be called multiple times throughout a program.
Functions can take in parameters and return values
Functions can be defined using function declarations or function expressions
Functions can be assigned to variables and passed as arguments to other functions
Q49. OOPs in java
OOPs in Java is a programming paradigm that focuses on objects and their interactions.
Encapsulation, Inheritance, Polymorphism, and Abstraction are the four pillars of OOPs in Java.
Encapsulation is the process of hiding implementation details from the user.
Inheritance is the process of inheriting properties and methods from a parent class.
Polymorphism is the ability of an object to take on many forms.
Abstraction is the process of hiding implementation details while showing on...read more
Top Interview Questions for GenC Related Skills
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
Reviews
Interviews
Salaries
Users/Month