– ‘ C ‘ –

Q: – Explain about storage of union elements. 

The key point about storage of union elements is that Union elements are use to share common memory space.

Q: – What is a memory leak?

Memory leak is that when memory is allocated but its not released because of an application consume memory reducing the available memory for other applications and causing the system to page virtual memory to the hard drive showing the application or crashing the application. When the computer memory resource limits are reached.

Q: – Is C is platform dependent or independent?how and why?

Major issue behind designing C language is that it is a small,portable programming language. It is used to implement an operating system.In past time C is a powerful tool for writing all types of program and has mechanism to achieve all most programming goals.So, we can say that C is platform dependent.

Q: – What are the stream files?

We can open file in C with using stream files.which are identified with a pointer to a FILE structure, or as low-level files, which are identified with an integer handle.

We can open stream files with using one of the following functions.

fopen(): Opens the specified file with the specified mode
freopen(): Closes the file specified, then opens a new file as specified
fdopen(): Opens a duplicate stream file for an already open low-level file

Q: – How the processor registers can be used in C? 

using keyword register we can use the process register in C.Basically process register is used to store variables those i want to access frequently.if these registers are not used in any other program,then those registers we used to allocate memory these variables.

Q: – How to access or modify the constt variable in C ?

We can not modify the constant variable.

Q: – Why n++ executes faster than n+1?

n++ executes faster than n+1 because n++ want only one instruction for execution where n+1 want more one instruction for execution.

Q: – What is the difference between the Heap and the Stack?

The main difference b/n the Heap and the Stack are given below:

– In stack we create object temporary where programmer used to reserve allocation.’
– stack not have automatic garbage collection where as heap have automatic garbage collection.

Q: – What is the Double LinkedList?

Double Linked List is that each data item in the list can point both side(next or previous)data item.It is not specific type means it may be of stack or queue.This is use to increase the performance of program.It is also called as Two-way Linked List or Symmetrically Linked list.

Q: – What are the advantages of high-level programming languages?

Readability, maintainability, and portability

Q: – Why is the main() function needed in a program?

The execution of a C program starts and ends with the main() function. Without the main() function, the computer does not know where to start to run a program.

Q: – What does the #include directive do?

The #include directive is used to include header files that contain the declarations to the functions used in your C program. In other words, the #include directive tells the C preprocessor to look into the include path to find the specified header file.

Q: – Why do you need a linker?

After compiling, some function code may still be missing in the object file of a program. A linker must then be used to link the object file to the C standard library or other user-generated libraries and include the missing function code so that an executable file can be created.

Q: – What is the difference between a constant and a variable?

The major difference is that the value of a constant cannot be changed, whereas the value of a variable can. You can assign different values to a variable whenever it’s necessary in your C program.

Q: – Why do you need a statement block?

Many C keywords can only control one statement. A statement block provides a way to put more than one statement together, and put the statement block under the control of a C keyword. Then, the statement block is treated as a single statement.

Q: – Which arithmetic operators have a higher precedence?

Among the five arithmetic operators, the multiplication, division, and remainder operators have a higher precedence than the addition and subtraction operators.

Q: – How many parts does a function normally have?

A function normally has six parts: the function type, the function name, the arguments, the opening brace, the function body, and the closing brace.

Q: – How can you declare two character variables?

There are two ways to do the declaration. The first one is

…char variable-name1, variable-name2;

The second one is

char variable-name1;
char variable-name2;

Q: – What are %c, %d, and %f?

These are format specifiers. %c is used to obtain the character format; %d is for the integer format; %f is for the floating-point format. %c, %d, and %f are often used with C functions such as printf().

Q: – What are the main differences between the int data type (integer) and the float data type (floating-point)?

First, an integer does not contain any fraction parts, but a floating-point number does. A floating-point number must have a decimal point. In C, the float data type takes more bits than the int data type. In other words, the float data type has a larger range of numeric values than the int data type.

Q: – What are stdin, stdout, and stderr?

In C, a file is treated as a series of bytes that is called file stream. stdin, stdout, and stderr are all pre-opened file streams. stdin is the standard input for reading; stdout is the standard output for writing; stderr is the standard error for outputting error messages.

Q: – What value is yielded by a relational expression?

A relational expression evaluates to either 0 or 1. If the relation indicated by a relational operator in an expression is true, the expression evaluates to 1; otherwise, the expression evaluates to 0.

Q: – Is the unary minus operator (-) the same as the subtraction operator (-)?

No, they are not the same, although the two operators share the same symbol. The meaning of the symbol is determined by the context in which it appears. The unary minus operator is used to change the sign of a numeric value. In other words, the unary minus operator yields the negation of the value. The subtraction operator is an arithmetic operator that performs a subtraction between its two operands.

Q: – Why do we need the sizeof operator?

The sizeof operator can be used to measure the sizes of all data types defined in C. When you write a portable C program that needs to know the size of an integer variable, it’s a bad idea to hard-code the size based on the machine you are currently using. The better way to tell the program the size of the variable is to use the sizeof operator, which yields the size of the integer variable at runtime.

Q: – What can the %lu format specifier do?

The %lu format specifier can be used in a printf() string to convert the corresponding argument to the unsigned long int data type. In addition, the %lu format specifier is equivalent to %Lu.

Q: – What are the left and right values?

The left value is the address of a variable, and the right value is the content stored in the memory location of a variable.

Q: – How can you obtain the address of a variable?

By using the address-of operator, &.

Q: – Can a null pointer point to valid data?

No. A null pointer cannot point to valid data. This is because the value contained by a null pointer has been set to 0.

Q: – What can the null character do?

The null character (‘’) in C can be used to mark the end of a string.

Q: – Can a global variable be hidden by a local variable with block scope?


Q: – Why do we need function prototypes?

With the help of a function prototype, the compiler can automatically perform type checking on the definition of the function, which saves you time in debugging the program.

Q: – Can a function return a pointer?


Q: – Why do you need to use arrays of pointers?

It is convenient to use an array of pointers to point to a set of character strings so that you can access any one of the strings referenced by a corresponding pointer in the array.

Q: – What does it mean if the malloc() function returns a null pointer?

If the malloc() function returns a null pointer, it means the function failed to allocate a block of memory whose size is specified by the argument passed to the function.

Q: – What are the differences between the calloc() and malloc() functions?

The calloc() function takes two arguments, while the malloc() function takes only one. The second difference is that the calloc() function initializes the allocated memory space to 0, whereas there is no such guarantee made by the malloc() function.

Q: – Is the free() function necessary?

Yes. The free() function is very necessary, and you should use it to free up allocated memory blocks as soon as you don’t need them.

Q: – What can you do with the enum data type?

The enum data type can be used to declare names that represent integer constants.

Q: – Why do you need to use the typedef keyword?

By using the typedef keyword, you can define your own names to represent the data types in C.

Q: – Can you redirect a standard stream to a disk file?

Yes. With the help of the freopen() function, you can redirect a standard stream and associate the stream with a disk file.

Q: – Is the C preprocessor part of the C compiler?


Q: – How do you remove a macro name?

By using the #undef directive with a macro name, that macro name can be removed, or “undefined.”

Q: – Why do you need the #endif directive?

The #endif directive is used with an #if, #ifdef, or #ifndef directives because statements under the control of a conditional preprocessor directive are not enclosed in braces ({ and }). Therefore, #endif must be used to mark the end of the block of statements.

Q: – Can the conditional expression following the #if directive be an arithmetic expression?


Q: – What is the difference b/n run time binding and compile time binding?

When the address of functions are determined a run time than it is called run time or dynamic binding or late binding. While when the addresses of functions are determined a compile time than it is called compile time or static binding or early binding.

Q: – Why do you need the #endif directive?

The key difference b/n linker and linkage is that linker is used to change an object code into an executable code by linking together the necessary build in functions. Place where we declare the variable in a program is called the linkage of variable.

Q: – What is the Double LinkedList?

Double Linked List is that each data item in the list can point both side(next or previous)data item.

Q: – Can we write a program with out using main() function?


Q: – Explain “method”?

A Method is a programmed procedure. It is defined as part of a class also included in any object of that class. Class can have more than one methods. It can be re-used in multiple objects.

Q: – What is the Double LinkedList?

Double Linked List is that each data item in the list can point both side(next or previous)data item.

Q: – Can we write a program with out using main() function?


Q: – Explain “method”?

A Method is a programmed procedure. It is defined as part of a class also included in any object of that class. Class can have more than one methods. It can be re-used in multiple objects.

Q: – Write a programme to display number from the bellow string?

char *ptr=”HELLO57hai”


int main()
char *ptr=”HELLO57hai”;

Q: – what are compilation process or steps?

prepocessor->compiler->assembler->linkEditor==Executable code

Q: – What is the output of the bellow program?

segmentation fault.because we are trying to read/assign character into const string.

char *ptr=”HELLO”;

Q: – There are numbers range from 1 to n randamly stored in the array and one number is missed in that array.write a program to find out missing number?

int missing_number(int a[],int n)
int Total,i;
Total -=a[i];
return Total;

Q: – What is the output of this Programme?

int main()
int x[]={1,3,2,4,6};
int *ptr,y;

Q: – How do you find middle element in the single linked list by traversing only one time from first to last?

we can findout middle element by taking two pointers.increment twice ptr1 while incrementing the ptr2 once ,so when ptr1 reaches to end of the node in the list,ptr2 will be pointing to middle element in the list. so we just return adress of middle element.
struct person*find_middle(struct person **listhead)
struct person *ptr1,*ptr2;
int i=0;
else if(i==1)

return ptr2;

Q: – What are “<<” and “>>” in C language. what is the output of the bellow code program?

int main()
int x=0x00AA;
int y=0x0055;
int z;
z=x<<8 + y>>8;


In C language <<(Left shift operator) and >>(Right shift operator) are called Bitwise operators and used to work on bits.
Z value is 4194304 for the above program.

Q: – What is Void pointer? can we perform arithimetic operations on void pointers?why? give one example?

void pointer is one kind of pointer ,it supports to hold data of all datatypes(like int,char,float etc).it’s also called generic pointer.we can’t perform arithimatic operations on void pointer because compiler doesn’t know the type of data to increment.


int main()
int a[]={100,200};
void *ptr;
printf(“%d\n”,*ptr); //here error occur.

Q: – What is the output of this program?

char *myfun(char *p)
return p;
int main()
int *p;
int *q;

Answer: LO.

Q: – Write a program to reverse a string with out using any array?

int main()
char *str=”Mahesh”;
char *ptr=str+strlen(str);


Q: – What is the output of this programe?

void Allocate(char *str, int size)
str =(char *)malloc(size);
int main()
char *str;
Allocate(str, 20);
strcpy(str, “HCL”);
strcat(str, “Technologies”);

Answer:Run time error(segmentation fault).

Reason: in function Allocate, we have allocated memory by using malloc function and assigned adress of that block to local pointer str. when control returns from that function the pointer (str) dies.so it will not affect in the main function. in main function,we are trying to read memory by using printf statement. so run time error occur.

Q: – What is the output of this programe?

char *ptr =”HCL Technologies”;

Answer:segmentation fault.because we are trying to modify the const string.

Q: – What is the output of this programe?

void show()
static int i=1;

int main()

Answer:1 2 3. static varibles values remain in function calls.if i(variable) in function show() islocal variable the out put would be 1 1 1.



MYSQL (DBMS) Interview Questions And Answers

Q: – What is REPLCAE statement, and how do I use it?

The REPLACE statement is the same as using an INSERT INTO command. The syntax is pretty much the same. The difference between an INSERT statement and a REPLACE statement is that MySQL will delete the old record and replace it with the new values in a REPLACE statement, hence the name REPLACE.

Q: – MySQL has a lot of neat functions. What if I need one that isn’t there?

MySQL is so flexible that it allows you to create your own functions. These user-defined functions act the same way that MySQL’s own intrinsic functions operate. It is also possible to recompile your functions into the application so that you will always have them, no matter how many times you install.

Q: – Do all unique keys have to be primary keys?

No. MySQL permits only one primary key per table, but there may be a number of unique keys. Both unique keys and primary keys can speed up the selecting of data with a WHERE clause, but a column should be chosen as the primary key if this is the column by which you want to join the table with other tables.

Q: – How many databases can one MySQL RDBMS contain?

Because MySQL uses the file system of the operating system, there really is no limit to the number of databases contained within a single MySQL RDBMS. The size of the database is limited by the operating system. The database tables can only be as big as the OS’s file system will allow.

Q: – I want to sort the values of my ENUM and SET columns. How do I do this?

The sort order depends on the order in which the values were inserted. ENUM and SET types are not case sensitive. The value that is inserted reverts to the value that you used when you created the ENUM or SET.

Q: – What can I do with the contents of a mysqldump file?

This file is a complete replica of your database in SQL format. You can do a lot of things with this data. You could re-create your database in Microsoft SQL Server or Sybase by simply cutting and pasting the contents of the file. You could also restore your database by using the dump file and the batching ability of the mysql program.

Q: – What are features of MYSQL ?

MySQL is a full-featured relational database management system. It is very stable and has proven itself over time. MySQL has been in production for over 10 years.

– MySQL is a multithreaded server. Multithreaded means that every time someone establishes a
connection with the server, the server program creates a thread or process to handle that client’s
requests. This makes for an extremely fast server. In effect, every client who connects to a MySQL
server gets his or her own thread.

– MySQL is also fully ANSI SQL92-compliant. It adheres to all the standards set forth by the American National Standards Institute.

– another feature of MySQL is its portability—it has been ported to almost every platform. This means that you don’t have to change your main platform to take advantage of MySQL. And if you do want to switch, there is probably a MySQL port for your new platform.

– MySQL also has many different application programming interfaces (APIs). They include APIs for Perl, TCL, Python, C/C++, Java (JDBC), and ODBC.

Q: – What do I do if I forget the MySQL root password?

First log in to the system as the same person who is running the mysqld
daemon (probably root). Kill the process, using the kill command.
Restart MySQL with the following arguments:
bin/mysqld Skip-grant
USE mysql;
UPDATE user SET password = password(‘newpassword’) WHERE User = ‘root’;
bin/mysqladmin reload

The next time you log in, you will use your new password

Q: – Where is the data stored in a MySQL database?

MySQL uses files to store data. These files are under the data/databasename directory, where databasename is the name of the database. There are three file types: .ISM, .FRM, and .ISD. The .FRM file contain the table schema. The .ISD is the file that actually holds the data. The .ISM file is the file that provides quick access between the two of them.

Q: – Explain the terms “mysqlimport”, “mysqldump”, “mysqladmin” and “mysqlcheck”?

mysqlimport for importing data files, mysqldump for making backups, mysqladmin for server administration, and mysqlcheck for checking the integrity of the database files.

Q: – How you will determine the options which are used by mysql?

#mysql –help

Q: – How you will determine the version of MySQL?

mysql –version

mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i386) using readline 5.1

Q: – How you will connect to the server at a specific IP address with username and password?

mysql –host= –user=NAME –password=PASSWORD

Q: – What do you think about this command “mysql> STATUS;”

It will display information about the current connection to the server, as well as status information about the server itself.

Q: – Have you used this command “mysql> HELP contents;”?

Yes, You can get server-side help from this command.

mysql> HELP contents;

You asked for help about help category: “Contents”

For more information, type ‘help <item>’, where <item> is one of

the following categories:


Column Types

Data Definition

Data Manipulation


Geographic features


Q: – What is MySQL Query Browser?

The MySQL Query Browser is a graphical tool designed to provide a user friendly environment in which to construct and execute SQL statements.

Q: – Explain “AUTO_INCREMENT” attribute?

AUTO_INCREMENT attribute may be added to an integer column definition to create a column for which MySQL automatically generates a new sequence number each time you create a new row. There may be only one AUTO_INCREMENT column per table, the column must be indexed, and the column must be defined as NOT NULL.

Q: – What this command “mysqladmin status variables” will do?

This command will display a brief status message, followed by the list of server system variables.

Q: – Explain “CHECK TABLE” statement?

The CHECK TABLE statement performs an integrity check on table structure and contents. It works for MyISAM and InnoDB tables. For MyISAM tables, it also updates the index statistics. If the table is a view, CHECK TABLE verifies the view definition.

Q: – Explain “REPAIR TABLE” statement?

The REPAIR TABLE statement corrects problems in a table that has become corrupted. It works only for MyISAM tables.

Q: – Explain “ANALYZE TABLE” statement?

The ANALYZE TABLE statement updates a table with information about the distribution of key values in the table. This information is used by the optimizer to make better choices about query execution plans. This statement works for MyISAM and InnoDB tables.

Q: – Explain “OPTIMIZE TABLE” statement?

The OPTIMIZE TABLE statement cleans up a MyISAM table by defragmenting it. This involves reclaiming unused space resulting from deletes and updates, and coalescing records that have become split and stored non-contiguously. OPTIMIZE TABLE also sorts the index pages if they are out of order and updates the index statistics.

Q: – What is “mysqlcheck Client Program”?

mysqlcheck checks, repairs, analyzes, and optimizes tables. It can perform all these operations on MyISAM tables, and can perform some of them on InnoDB tables. It provides a command-line interface to the various SQL statements that instruct the server to perform table maintenance, such as CHECK TABLE and REPAIR TABLE.

Q: – What is “myisamchk Utility”?

The myisamchk utility performs table maintenance on MyISAM tables.

Q: – What is the use of “INFORMATION_SCHEMA Database”?

The INFORMATION_SCHEMA database provides access to database metadata.INFORMATION_SCHEMA is a “virtual database” in the sense that it is not stored anywhere on disk. But like any other database, it contains tables, and its tables contain rows and columns that can be accessed by means of SELECT statements.

Q: – What is “binary backup”?

A binary backup is a copy of the files in which database contents are stored. Copying these files preserves the databases in exactly the same format in which MySQL itself stores them on disk. Restoration involves copying the files back to their original locations. Techniques for making binary backups include file copy commands.

Q: – What is “text backup”?

A text backup is a dump of database contents into text files. Restoration involves loading the file contents back into databases by processing them through the server. Techniques for making text backups include the SELECT … INTO OUTFILE SQL statement, mysqldump, and MySQL Administrator.

Q: – How you will grant the SELECT privilege for all tables in the TEST database to a user named Ravi, who must connect from the local host and use a password of Ravi123?

Use following command.

GRANT SELECT ON TEST.* TO ‘Ravi’@’localhost’ IDENTIFIED BY ‘Ravi123’;

Q: – Explain “REVOKE statement”?

The REVOKE statement to revoke privileges from an account.

Q: – Explain the command “SHOW GRANTS FOR ‘root’@’localhost’;”

It will show the account has global, database-level, and table-level privileges.

.net Interview Questions And Answers

Q: – What is “Common Language Specification” (CLS) in .NET? 

CLS is the collection of the rules and constraints that every language (that seeks to achieve .NET compatibility) must follow. It is a subsection of CTS and it specifies how it shares and extends one another libraries.

Q: – What are Attributes in .NET? 

Attributes are declarative tags in code that insert additional metadata into an assembly. There exist two types of attributes in the .NET Framework: Predefined attributes such as Assembly Version, which already exist and are accessed through the Runtime Classes; and custom attributes, which you write yourself by extending the System

Q: – What are possible implementations of distributed applications in .NET?

.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.


Q: – How to manage pagination in a page using .NET?

Using pagination option in DataGrid control is available in .NET. We have to set the number of records for a page, then it takes care of pagination by itself automatically.


Q: – What is ADO .NET and what is difference between ADO and ADO.NET?

ADO.NET is stateless mechanism. I can treat the ADO.Net as a separate in-memory database where in I can use relationships between the tables and select insert and updates to the database. I can update the actual database as a batch.


Q: – What is Reflection in .NET? 

It extends the benefits of metadata by allowing developers to inspect and use it at runtime. For example, dynamically determine all the classes contained in a given assembly and invoke their methods. Reflection provides objects that encapsulate assemblies, modules, and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object. You can then invoke the type’s methods or access its fields and properties. Namespace: System.Reflection

Q: – What Is ASP.NET?

ASP.NET, or Active Server Pages for the .NET Framework, is a technology for providing dynamic Web page content to your users.


Q Does using code-behind techniques with ASP.NET result in faster code?

Q Is the Page_Load event the best place to validate the contents of an ASP.NET page?


Q: – What Is XML?

XML is a way to represent structured data. Just like HTML, XML uses tags to enclose each piece of data. Unlike HTML, however, with XML you pick the names for each tag so that they are appropriate for your own dataset. One big advantage of XML is that the data contained in XML files is “self-describing,” because each data element is enclosed in HTML-like tags that give contextual clues about the data.


Q: – What Is XSL?

The eXtensible Stylesheet Language (XSL) is used to transform XML files into HTML, new and differently formatted XML files, text files, or other formats.


Q: – I want to add a custom method to my typed dataset. How should I do this?

 Don’t modify the automatically generated file itself because Visual Studio could rewrite it when you modify the source XML Schema. Instead, create a new class derived from the automatically generated class with your custom methods.


Q: – I store all my application data using XML. Can I still use the techniques presented
in the last part of this chapter?



Q Which UDDI provider should I use to publish my Web Service?

Choosing a UDDI provider is only a matter of personal preference. All UDDI providers share the same database of information. After you make a UDDI entry in one provider, the entry propagates to all other UDDI providers within a short amount of time.


Q: – Can malicious users read my configuration files and find out confidential information about my Web site?



Q: – I store all my application data using XML. Can I still use the techniques presented
in the last part of this chapter?



Q Which UDDI provider should I use to publish my Web Service?

Choosing a UDDI provider is only a matter of personal preference. All UDDI providers share the same database of information. After you make a UDDI entry in one provider, the entry propagates to all other UDDI providers within a short amount of time.


Q: – Can malicious users read my configuration files and find out confidential information about my Web site?





How to achieve Polymorphism in VB.Net?

We can achieve polymarphism in .Net i.e Compile time polymarphism and Runtime polymarphism. Compiletime Polymarphism achieved by method overloading. Runtime polymarphism achieved by Early Binding or Late Binding. Provide the function pointer to the object at compile time called as Early Binding. provide the function pointer to the object at runtime called as Late Binding
class emp having the method display()
class dept having the method display()

create objects as in the main function
// Early binding
dim obj as new emp
dim ob as new dept

obj.display()-to call the display method of emp class
ob.display-to call the display method of the dept class
// Late binding

create object in the main class as
object obj
obj=new emp
obj.display()-to call the display of emp class
obj=new dept
obj.display()-to call the display of dept class

What is Serialization in .NET?

The serialization is the process of converting the objects into stream of bytes.
they or used for transport the objects(via remoting) and persist objects(via files and databases)

When developing smaller applications that do not have a database (or other formal storage mechanism) or data that doesn’t need to be stored in a database (such as the state of a web application), you often still would like to save the data for later retrieval. There are many ways to do this, but many of them are subject to a lot of extra code (work) and extra time spent debugging. With .NET, there is now an easy way to add this functionality to your code with only a few lines of easily tested code. This easy way is called serialization.

Serialization is the process of storing an object, including all of its public and private fields, to a stream. Deserialization is the opposite – restoring an object’s field values from a stream. The stream is generally in the form of a FileStream, but does not have to be. It could be a memory stream or any other object that is of type IO.Stream. The format can be anything from XML to binary to SOAP.

What is Delegation?

A delegate acts like a strongly type function pointer. Delegates can invoke the methods that they reference without making explicit calls to those methods.
Delegate is an entity that is entrusted with the task of representation, assign or passing on information. In code sense, it means a Delegate is entrusted with a Method to report information back to it when a certain task (which the Method expects) is accomplished outside the Method’s class.

[.net] webFarm Vs webGardens

A web farm is a multi-server scenario. So we may have a server in each state of US. If the load on one server is in excess then the other servers step in to bear the brunt.
How they bear it is based on various models.
1. RoundRobin. (All servers share load equally)
2. NLB (economical)
3. HLB (expensive but can scale up to 8192 servers)
4. Hybrid (of 2 and 3).
5. CLB (Component load balancer).
A web garden is a multi-processor setup. i.e., a single server (not like the multi server above).
How to implement webfarms in .Net:
Go to web.config and Here for mode = you have 4 options.
a) Say mode=inproc (non web farm but fast when you have very few customers).
b) Say mode=StateServer (for webfarm)
c) Say mode=SqlServer (for webfarm)
Whether to use option b or c depends on situation. StateServer is faster but SqlServer is more reliable and used for mission critical applications.
How to use webgardens in .Net:
Go to web.config and Change the false to true. You have one more attribute that is related to webgarden in the same tag called cpuMask.