Monday, October 13, 2008

Oracle Interview Questions

Oracle Interview Questions withAnswers

Interview Questions : What are the components of physical database structure of Oracle database?
Oracle database is comprised of three types of files. One or more datafiles, two are more redo log files, and one or more control files.

Interview Questions : What are the components of logical database structure of Oracle database?
There are tablespaces and database's schema objects.
What is a tablespace? A database is divided into Logical Storage Unit called tablespaces. A tablespace is used to grouped related logical structures together.

Interview Questions : What is SYSTEM tablespace and when is it created?
Every Oracle database contains a tablespace named SYSTEM, which is automatically created when the database is created. The SYSTEM tablespace always contains the data dictionary tables for the entire database.

Interview Questions : What is schema?
A schema is collection of database objects of a user.

Interview Questions : What are Schema Objects?
Schema objects are the logical structures that directly refer to the database's data. Schema objects include tables, views, sequences, synonyms, indexes, clusters, database triggers, procedures, functions packages and database links.
Can objects of the same schema reside in different tablespaces? Yes.
Can a tablespace hold objects from different schemes? Yes.

Interview Questions : What is Oracle table?
A table is the basic unit of data storage in an Oracle database. The tables of a database hold all of the user accessible data. Table data is stored in rows and columns.

Interview Questions : What is an Oracle view?
A view is a virtual table. Every view has a query attached to it. (The query is a SELECT statement that identifies the columns and rows of the table(s) the view uses.)

Interview Questions : What is Partial Backup ?
A Partial Backup is any operating system backup short of a full backup, taken while the database is open or shut down.

Interview Questions : What is Mirrored on-line Redo Log ?
A mirrored on-line redo log consists of copies of on-line redo log files physically located on separate disks, changes made to one member of the group are made to all members.

Interview Questions : What is Full Backup ?
A full backup is an operating system backup of all data files, on-line redo log files and control file that constitute ORACLE database and the parameter.
Can a View based on another View ? Yes.
Can a Tablespace hold objects from different Schemes ? Yes.
Can objects of the same Schema reside in different tablespace ? Yes.

Interview Questions : What is the use of Control File ?
When an instance of an ORACLE database is started, its control file is used to identify the database and redo log files that must be opened for database operation to proceed. It is also used in database recovery.
Do View contain Data ? Views do not contain or store data.
What are the Referential actions supported by FOREIGN KEY integrity constraint ? UPDATE and DELETE Restrict - A referential integrity rule that disallows the update or deletion of referenced data. DELETE Cascade - When a referenced row is deleted all associated dependent rows are deleted.

Interview Questions : What are the type of Synonyms?
There are two types of Synonyms Private and Public.

Interview Questions : What is a Redo Log ?
The set of Redo Log files YSDATE,UID,USER or USERENV SQL functions, or the pseudo columns LEVEL or ROWNUM.

Interview Questions : What is an Index Segment ?
Each Index has an Index segment that stores all of its data.

Interview Questions : Explain the relationship among Database, Tablespace and Data file?
Each databases logically divided into one or more tablespaces one or more data files are explicitly created for each tablespace

Interview Questions : What are the different type of Segments ?
Data Segment, Index Segment, Rollback Segment and Temporary Segment.

Interview Questions : What are Clusters ?
Clusters are groups of one or more tables physically stores together to share common columns and are often used together.

Interview Questions : What are the basic element of Base configuration of an oracle Database ?
It consists ofone or more data files.one or more control files.two or more redo log files.The Database containsmultiple users/schemasone or more rollback segmentsone or more tablespacesData dictionary tablesUser objects (table,indexes,views etc.,)The server that access the database consists ofSGA (Database buffer, Dictionary Cache Buffers, Redo log buffers, Shared SQL pool)SMON (System MONito)PMON (Process MONitor)LGWR (LoG Write)DBWR (Data Base Write)ARCH (ARCHiver)CKPT (Check Point)RECODispatcherUser Process with associated PGS

SQL Interview Question

SQL Interview Question with Answer

Interview Question : What is denormalization and when would you go for it?
As the name indicates, denormalization is the reverse process ofnormalization. It's the controlled introduction of redundancy in tothe database design. It helps improve the query performance as thenumber of joins could be reduced.

Interview Question : How do you implement one-to-one, one-to-many and many-to-manyrelationships while designing tables?
One-to-One relationship can be implemented as a single table andrarely as two tables with primary and foreign key relationships.One-to-Many relationships are implemented by splitting the data intotwo tables with primary key and foreign key relationships.Many-to-Many relationships are implemented using a junction table withthe keys from both the tables forming the composite primary key of thejunction table.
It will be a good idea to read up a database designing fundamentalstext book.

Interview Question : What's the difference between a primary key and a unique key?
Both primary key and unique enforce uniqueness of the column on whichthey are defined. But by default primary key creates a clustered indexon the column, where are unique creates a nonclustered index bydefault. Another major difference is that, primary key doesn't allowNULLs, but unique key allows one NULL only.
What are user defined datatypes and when you should go for them?
User defined datatypes let you extend the base SQL Server datatypes byproviding a descriptive name, and format to the database. Take forexample, in your database, there is a column called Flight_Num whichappears in many tables. In all these tables it should be varchar(8).In this case you could create a user defined datatype calledFlight_num_type of varchar(8) and use it across all your tables.
See sp_addtype, sp_droptype in books online.

Interview Question : What is bit datatype and what's the information that can be storedinside a bit column?
Bit datatype is used to store boolean information like 1 or 0 (true orfalse). Untill SQL Server 6.5 bit datatype could hold either a 1 or 0and there was no support for NULL. But from SQL Server 7.0 onwards,bit datatype can represent a third state, which is NULL.

Interview Question : Define candidate key, alternate key, composite key.
A candidate key is one that can identify each row of a table uniquely.Generally a candidate key becomes the primary key of the table. If thetable has more than one candidate key, one of them will become theprimary key, and the rest are called alternate keys.
A key formed by combining at least two or more columns is calledcomposite key.

Interview Question : What are defaults? Is there a column to which a default can't be bound?
A default is a value that will be used by a column, if no value issupplied to that column while inserting data. IDENTITY columns andtimestamp columns can't have defaults bound to them. See CREATEDEFUALT in books online.
Back to topSQL Server architecture (top)

Interview Question : What is a transaction and what are ACID properties?
A transaction is a logical unit of work in which, all the steps mustbe performed or none. ACID stands for Atomicity, Consistency,Isolation, Durability. These are the properties of a transaction. Formore information and explanation of these properties, see SQL Serverbooks online or any RDBMS fundamentals text book.

Interview Question : Explain different isolation levels
An isolation level determines the degree of isolation of data betweenconcurrent transactions. The default SQL Server isolation level isRead Committed. Here are the other isolation levels (in the ascendingorder of isolation): Read Uncommitted, Read Committed, RepeatableRead, Serializable. See SQL Server books online for an explanation ofthe isolation levels. Be sure to read about SET TRANSACTION ISOLATIONLEVEL, which lets you customize the isolation level at the connectionlevel.
CREATE INDEX myIndex ON myTable(myColumn)

Interview Question : What type of Index will get created after executing the above statement?
Non-clustered index. Important thing to note: By default a clusteredindex gets created on the primary key, unless specified otherwise.
What's the maximum size of a row?
8060 bytes. Don't be surprised with questions like 'what is themaximum number of columns per table'. Check out SQL Server booksonline for the page titled: "Maximum Capacity Specifications".

Interview Question : Explain Active/Active and Active/Passive cluster configurations
Hopefully you have experience setting up cluster servers. But if youdon't, at least be familiar with the way clustering works and the twoclusterning configurations Active/Active and Active/Passive. SQLServer books online has enough information on this topic and there isa good white paper available on Microsoft site.

Interview Question : Explain the architecture of SQL Server
This is a very important question and you better be able to answer itif consider yourself a DBA. SQL Server books online is the best placeto read about SQL Server architecture. Read up the chapter dedicatedto SQL Server Architecture.

Interview Question : What is lock escalation?
Lock escalation is the process of converting a lot of low level locks(like row locks, page locks) into higher level locks (like tablelocks). Every lock is a memory structure too many locks would mean,more memory being occupied by locks. To prevent this from happening,SQL Server escalates the many fine-grain locks to fewer coarse-grainlocks. Lock escalation threshold was definable in SQL Server 6.5, butfrom SQL Server 7.0 onwards it's dynamically managed by SQL Server.

Interview Question : What's the difference between DELETE TABLE and TRUNCATE TABLE commands?
DELETE TABLE is a logged operation, so the deletion of each row getslogged in the transaction log, which makes it slow. TRUNCATE TABLEalso deletes all the rows in a table, but it won't log the deletion ofeach row, instead it logs the deallocation of the data pages of thetable, which makes it faster. Of course, TRUNCATE TABLE can be rolledback.

Interview Question : Explain the storage models of OLAP
Check out MOLAP, ROLAP and HOLAP in SQL Server books online for moreinfomation.
What are the new features introduced in SQL Server 2000 (or the latestrelease of SQL Server at the time of your interview)? What changedbetween the previous version of SQL Server and the current version?
This question is generally asked to see how current is your knowledge.Generally there is a section in the beginning of the books onlinetitled "What's New", which has all such information. Of course,reading just that is not enough, you should have tried those things tobetter answer the questions. Also check out the section titled"Backward Compatibility" in books online which talks about the changesthat have taken place in the new version.
What are constraints? Explain different types of constraints.
Constraints enable the RDBMS enforce the integrity of the databaseautomatically, without needing you to create triggers, rule or defaults.
Types of constraints: NOT NULL, CHECK, UNIQUE, PRIMARY KEY, FOREIGN KEY
For an explanation of these constraints see books online for the pagestitled: "Constraints" and "CREATE TABLE", "ALTER TABLE"

Interview Question : Whar is an index? What are the types of indexes? How many clusteredindexes can be created on a table?
I create a separate index on eachcolumn of a table. what are the advantages and disadvantages of thisapproach?
Indexes in SQL Server are similar to the indexes in books. They helpSQL Server retrieve the data quicker.
Indexes are of two types. Clustered indexes and non-clustered indexes.When you craete a clustered index on a table, all the rows in thetable are stored in the order of the clustered index key. So, therecan be only one clustered index per table. Non-clustered indexes havetheir own storage separate from the table data storage. Non-clusteredindexes are stored as B-tree structures (so do clustered indexes),with the leaf level nodes having the index key and it's row locater.The row located could be the RID or the Clustered index key, dependingup on the absence or presence of clustered index on the table.
If you create an index on each column of a table, it improves thequery performance, as the query optimizer can choose from all theexisting indexes to come up with an efficient execution plan. At thesame t ime, data modification operations (such as INSERT, UPDATE,DELETE) will become slow, as every time data changes in the table, allthe indexes need to be updated. Another disadvantage is that, indexesneed disk space, the more indexes you have, more disk space is used.
Back to topDatabase administration (top)

Interview Question : What is RAID and what are different types of RAID configurations?
RAID stands for Redundant Array of Inexpensive Disks, used to providefault tolerance to database servers. There are six RAID levels 0through 5 offering different levels of performance, fault tolerance.MSDN has some information about RAID levels and for detailedinformation, check out the RAID advisory board's homepage

Interview Question : What are the steps you will take to improve performance of a poorperforming query?
This is a very open ended question and there could be a lot of reasonsbehind the poor performance of a query. But some general issues thatyou could talk about would be: No indexes, table scans, missing or outof date statistics, blocking, excess recompilations of storedprocedures, procedures and triggers without SET NOCOUNT ON, poorlywritten query with unnecessarily complicated joins, too muchnormalization, excess usage of cursors and temporary tables.
Some of the tools/ways that help you troubleshooting performanceproblems are: SET SHOWPLAN_ALL ON, SET SHOWPLAN_TEXT ON, SETSTATISTICS IO ON, SQL Server Profiler, Windows NT /2000 Performancemonitor, Graphical execution plan in Query Analyzer.
Download the white paper on performance tuning SQL Server fromMicrosoft web site. Don't forget to check out sql-server-performance.com

Interview Question : What are the steps you will take, if you are tasked with securing anSQL Server?
Again this is another open ended question. Here are some things youcould talk about: Preferring NT authentication, using server, databseand application roles to control access to the data, securing thephysical database files using NTFS permissions, using an unguessableSA password, restricting physical access to the SQL Server, renamingthe Administrator account on the SQL Server computer, disabling theGuest account, enabling auditing, using multiprotocol encryption,setting up SSL, setting up firewalls, isolating SQL Server from theweb server etc.
Read the white paper on SQL Server security from Microsoft website.Also check out My SQL Server security best practices

Saturday, October 11, 2008

C++ Interview Question Part#5

Job C++ Interview Question with Answer

C++ Interview Question: What is the difference between char a[] = “string”; and char *p = “string”;?
In the first case 6 bytes are allocated to the variable a which is fixed, where as in the second case if *p is assigned to some other value the allocate memory can change.

C++ Interview Question: What’s the auto keyword good for?
It declares an object with automatic storage duration. Which means the object will be destroyed at the end of the objects scope. All variables in functions that are not declared as static and not dynamically allocated have automatic storage duration by default. For exampleint main(){int a; //this is the same as writing “auto int a;”} .variables occur within a scope; they are “local” to a function. They are often called automatic variables because they automatically come into being when the scope is entered and automatically go away when the scope closes. The keyword auto makes this explicit, but local variables default to auto auto auto auto so it is never necessary to declare something as an auto auto auto auto.

C++ Interview Question: What is a dangling pointer?
A dangling pointer arises when you use the address of an object afterits lifetime is over. This may occur in situations like returningaddresses of the automatic variables from a function or using theaddress of the memory block after it is freed. The followingcode snippet shows this:class Sample{public:int *ptr;Sample(int i){ptr = new int(i);}~Sample(){delete ptr;}void PrintVal(){cout << "The value is " << *ptr;}};void SomeFunc(Sample x){cout << "Say i am in someFunc " << endl;}int main(){Sample s1 = 10;SomeFunc(s1);s1.PrintVal();}In the above example when PrintVal() function iscalled it is called by the pointer that has been freed by thedestructor in SomeFunc.

C++ Interview Question Part#4

Job C++ Interview Question with Answer:

C++ Interview Question : What is a COPY CONSTRUCTOR and when is it called?
A copy constructor is a method that accepts an object of the same class and copies it’s data members to the object on the left part of assignement: class Point2D{int x; int y;public int color;protected bool pinned;public Point2D() : x(0) , y(0) {} //default (no argument) constructorpublic Point2D( const Point2D & ) ;};Point2D::Point2D( const Point2D & p ){this->x = p.x;this->y = p.y;this->color = p.color;this->pinned = p.pinned;}main(){Point2D MyPoint;MyPoint.color = 345;Point2D AnotherPoint = Point2D( MyPoint ); // now AnotherPoint has color = 345

C++ Interview Question : What is virtual class and friend class?
Friend classes are used when two or more classes are designed to work together and need access to each other's implementation in ways that the rest of the world shouldn't be allowed to have. In other words, they help keep private things private. For instance, it may be desirable for class DatabaseCursor to have more privilege to the internals of class Database than main() has.

C++ Interview Question : What is the difference between an object and a class?
Classes and objects are separate but related concepts. Every object belongs to a class and every class contains one or more related objects.- A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change.- The class to which an object belongs is also (usually) static. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belong to that class right up until the time that it is destroyed.- An Object on the other hand has a limited lifespan. Objects are created and eventually destroyed. Also during that lifetime, the attributes of the object may undergo significant change.

C++ Interview Question : What is friend function?
As the name suggests, the function acts as a friend to a class. As a friend of a class, it can access its private and protected members. A friend function is not a member of the class. But it must be listed in the class definition.

C++ Interview Question : What are virtual functions?
A virtual function allows derived classes to replace the implementation provided by the base class. The compiler makes sure the replacement is always called whenever the object in question is actually of the derived class, even if the object is accessed by a base pointer rather than a derived pointer. This allows algorithms in the base class to be replaced in the derived class, even if users don't know about the derived class.

C++ Interview Question : What is the difference between an external iterator and an internal iterator? Describe an advantage of an external iterator.
An internal iterator is implemented with member functions of the class that has items to step through. .An external iterator is implemented as a separate class that can be "attach" to the object that has items to step through. .An external iterator has the advantage that many difference iterators can be active simultaneously on the same object.

C++ Interview Question : What do you mean by pure virtual functions?
A pure virtual member function is a member function that the base class forces derived classes to provide. Normally these member functions have no implementation. Pure virtual functions are equated to zero.class Shape { public: virtual void draw() = 0; };

C++ Interview Question Part#3

Job C++ Interview Question

Interview Question: How do you find out if a linked-list has an end? (i.e. the list is not a cycle)
You can find out by using 2 pointers. One of them goes 2 nodes each time. The second one goes at 1 nodes each time. If there is a cycle, the one that goes 2 nodes each time will eventually meet the one that goes slower. If that is the case, then you will know the linked-list is a cycle.
What is the difference between realloc() and free()? The free subroutine frees a block of memory previously allocated by the malloc subroutine. Undefined results occur if the Pointer parameter is not a valid pointer. If the Pointer parameter is a null value, no action will occur. The realloc subroutine changes the size of the block of memory pointed to by the Pointer parameter to the number of bytes specified by the Size parameter and returns a new pointer to the block. The pointer specified by the Pointer parameter must have been created with the malloc, calloc, or realloc subroutines and not been deallocated with the free or realloc subroutines. Undefined results occur if the Pointer parameter is not a valid pointer.

Interview Question: What is function overloading and operator overloading?
Function overloading: C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading. When an overloaded function is called, the C++ compiler selects the proper function by examining the number, types and order of the arguments in the call. Function overloading is commonly used to create several functions of the same name that perform similar tasks but on different data types. Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes. Overloaded operators are syntactic sugar for equivalent function calls. They form a pleasant facade that doesn't add anything fundamental to the language (but they can improve understandability and reduce maintenance costs).

Interview Question: What is the difference between declaration and definition?
The declaration tells the compiler that at some later point we plan to present the definition of this declaration.E.g.: void stars () //function declaration The definition contains the actual implementation.E.g.: void stars () // declarator{for(int j=10; j > =0; j--) //function bodycout << *;cout << endl; }

Interview Question: Tell how to check whether a linked list is circular.
Create two pointers, each set to the start of the list. Update each as follows:
while (pointer1) {pointer1 = pointer1->next;pointer2 = pointer2->next; if (pointer2) pointer2=pointer2->next;if (pointer1 == pointer2) {print (\"circular\n\");}}

Interview Question: What is the difference between class and structure?
Structure: Initially (in C) a structure was used to bundle different type of data types together to perform a particular functionality. But C++ extended the structure to contain functions also. The major difference is that all declarations inside a structure are by default public. Class: Class is a successor of Structure. By default all the members inside the class are private

Interview Question: Describe PRIVATE, PROTECTED and PUBLIC – the differences and give examples
.class Point2D{int x; int y;public int color;protected bool pinned;public Point2D() : x(0) , y(0) {} //default (no argument) constructor};Point2D MyPoint;You cannot directly access private data members when they are declared (implicitly) private: MyPoint.x = 5; // Compiler will issue a compile ERROR//Nor yoy can see them:int x_dim = MyPoint.x; // Compiler will issue a compile ERROROn the other hand, you can assign and read the public data members: MyPoint.color = 255; // no problemint col = MyPoint.color; // no problemWith protected data members you can read them but not write them: MyPoint.pinned = true; // Compiler will issue a compile ERROR bool isPinned = MyPoint.pinned; // no problem

C++ Interview Question Part#2

The Hot C++ Interview Question:

How do you rank your C++ skills on a scale of 1 to 10?
This is often the first question you will hear on an interview for a C++ contract. You will be tempted to rate yourself high, and you should. This is your chance to convince the client that you are just what he is looking for--an assertive and knowledgeable professional who will be productive either working on a team or on your own. Naturally, though, you should be able to support the ranking you gave yourself by doing well on the interview.
Q1. Is there anything you can do in C++ that you cannot do in C?
A1. No. There is nothing you can do in C++ that you cannot do in C. After all you can write a C++ compiler in C.
Q2. What is the difference between C++ structure and C++ class?
A2. The default access level assigned to members of struct is public while the default access level assigned to a class is private.
Q3. What is encapsulation?
A3. Encapsulation is welding of code and data together into objects.
Q4. What is inheritance?
A4. Inheritance is a mechanism through which a subclass inherits the properties and behavior of its superclass.
Q5. What is polymorphism?
A5. In Greek this means "many shapes." As a consequence of inheritance and virtual functions, a single task (for example, drawing a geometrical shape) can be implemented using the same name (like draw()) and implemented differently (via virtual functions) as each type in object hierarchy requires(circle.draw() or rectangle.draw()). Later, when a polymorphic object (whose type is not known at compile time) executes the draw() virtual function, the correct implementation is chosen and executed at run time.
Q6. What would you say if you saw "delete this" while reviewing your peer's code?
A6. You should never do this. Since compiler does not know whether the object was allocated on the stack or on the heap, "delete this" could cause a disaster.
Q7. What is the difference between public, protected, and private members of a class?
A7. Private members are accessible only by members and friends of the class. Protected members are accessible by members and friends of the class and by members and friends of derived classes. Public members are accessible by everyone.
Q8. What is the difference between non-virtual and virtual functions?
A8. The behavior of a non-virtual function is known at compile time while the behavior of a virtual function is not known until the run time.
Q9. What is a pure virtual function?
A9. "A pure virtual function is a function declared in a base class that has no definition relative to the base."
Q10. What is an abstract base class?
A10. It is a class that has one or more pure virtual functions.

C++ Interview Question:

C++ Interview Question:

1. Does a class provide default Copy Constructor?
Yes! The default copy constructor is being provided automatically by the compiler if not implemented separately. In this, it puts the code for coping the data members and other variables that stay in stack. If something is being created by malloc or new in the heap, those are not being copied by the default copy constructor provide by the compiler.

2. What does a default Copy Constructor do?
A default copy constructor is being provided by the compiler, when an attempt to copy an existing object is made. In this case the control goes to the default copy constructor. It generates a new object, and makes the values of data members of the new object which are in the stack, same as the parent object. It doesn’t copy the variables that are created in the heap. Simply speaking, a compiler supplied default copy constructor doesn’t take care of the things in an object, that are being created using malloc/calloc or new.
3. Can a program have a virtual constructor?
Generally we don’t need an overridable constructor. So constructor should not be declared as virtual. But in a class, we can make a static method, which will call the private/protected constructor and create an object. In that case the constructor is called as virtual constructor.

4. When does a programmer need to implement his own copy constructor?
Though compiler automatically provides the default copy constructor, sometime a programmer needs to implement his own copy constructor. We can take up a case here:

In the default constructor some memory allocation has been done for few data members and hence those will be created in the heap. In the destructor corresponding de-allocation code is there. Now if an attempt to copy an object is made, it won’t call the default constructor but it will call the default copy constructor which will copy the data member variable from stack and copy the pointers but won’t allocate any new memory space for the new copied object. So same pointers will exist in both the parent and copied object. This will not only create a great ambiguity but runtime error will occur when attempts will be made to delete both the objects. First object will get deleted properly. When it will try to delete the other object, the common pointer won’t exist and runtime error will come. Even if user stops the application it will try to delete all the objects in the memory and runtime error will occur. In a single word, copy constructor is needed to be implemented independently, when the parent object has some allocated memory in heap for some of its data member and that gets deleted by destructor. Copy constructor should consist that much of code for memory allocation for the newly created object.Apart from this, programmer can implement his own copy constructor to copy any other things, which he wants specifically.

5. Can a copy constructor accept an object of the same class as parameter, instead of reference of the object?
No. It is specified in the definition of the copy constructor itself. It should generate an error if a programmer specifies a copy constructor with a first argument that is an object and not a reference.

Logically thinking, if we can consider the same as copy constructor also, big confusion will come. If we pass an object as a function parameter, by value, it will get copied first and then be passed to the function. At the time of getting copied it should call the copy constructor. So in this case, if we consider the above described constructor as copy constructor, at the very beginning of the function call, it wil attempt to copy the object and hence again call the same function and hence will go towards an infinite loop. This will probably be ended up with an unexpected stack overflow.

It will give compiler error if an object of the same class is being passed to a constructor, but it doesn’t give error if more than one different objects are being passed to the constructor . In this case it doesn’t treat it as copy constructor, but a normal overloaded constructor.

6. What is the return parameter of a constructor and why?
Constructor in never being called directly. It is being called automatically by the compiler when an object in being created (or copied). Hence it can’t return any parameter. Logically thinking, if it would have been made to return a parameter, how do we put the code to create an object?

7. Are the “default constructor” and “constructor with default parameter” same?
Default constructor is a constructor, which can be called with no argument. So a constructor with all the parameters as default argument can be called as default constructor. A constructor with one or more default parameters (but not all the parameters) can be called “constructor with default parameter” but that won’t be the default constructor.

If a constructor with no argument and a constructor with all default arguments are being implemented then object-creation will generate an ambiguity regarding which constructor is to be called.