C INTERVIEW QUESTIONS
WHAT ARE DIFFERENT TECHNIQUES FOR MAKING HASH FUNCTION?
Techniques for making hash function.
• Truncation Method
This is the simplest method for computing address from a key.In this method we take only a part of the key as address.
• Midsquare Method
In this method the key is squared and some digits from the middle of this square are taken as address.
• Folding Method
In this technique, the key is divided into different part where the length of each part is same as that of the required address, except possibly the last part.
• Division Method (Modulo-Division)
In Modulo-Division method the key is divided by the table size and the remainder is taken as the address of the hash table.
–>Let the table size is n then
H (k) =k mod n
• Truncation Method
This is the simplest method for computing address from a key.In this method we take only a part of the key as address.
• Midsquare Method
In this method the key is squared and some digits from the middle of this square are taken as address.
• Folding Method
In this technique, the key is divided into different part where the length of each part is same as that of the required address, except possibly the last part.
• Division Method (Modulo-Division)
In Modulo-Division method the key is divided by the table size and the remainder is taken as the address of the hash table.
–>Let the table size is n then
H (k) =k mod n
Master C and Data Structure, in this C and Data Structure certification training.
WHAT IS A POINTER?
A pointer is a variable that represents the location (rather than the value) of a data item, such as a variable or an array element. It is a variable that holds a memory address. This address is the location of another variable or an array element in memory.
HOW TO DECLARE POINTER VARIABLES?
If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is data _type * var_ name;
WHAT IS THE DIFFERENCE BETWEEN FREAD BUFFER() AND FWRITE BUFFER()?
Fread(), buffer is a pointer to an area of memory that will receive the data from the file. For fwrite(), buffer is a pointer to the information that will be written to the file. The value of count determines how many items are read or written, with each item being num_byte bytes in length.
The size_t in both the formats is defined as some kind of unsigned integer. Finally, fp is a file pointer to a previously opened file.
The size_t in both the formats is defined as some kind of unsigned integer. Finally, fp is a file pointer to a previously opened file.
WHAT IS MACRO?
The second preprocessor function is macro definition. A macro is formal syntax that can be used to generate statements for use in a program. For the C language, the macro generates C statements.
WHAT ARE THE TYPES OF I/O FUNCTIONS?
- I/O functions are grouped into two categories :
- Unformatted I/O functions
- Formatted I/O functions
WHAT IS THE DIFFERENCE B/W FORMATTED&UNFORMATTED I/O FUNCTIONS?
The formatted I/O functions allow programmers to specify the type of data and the way in which it should be read in or written out. On the other hand, unformatted I/O functions do not specify the type of data and the way is should be read or written.
HOW TO DECLARE POINTER VARIABLES?
If a variable is going to be a pointer, it must be declared as such. A pointer declaration consists of a base type, an *, and the variable name. The general form for declaring a pointer variable is data _type * var_ name;
WHAT IS THE DIFFERENCE BETWEEN C &C++?
C++ is an object oriented programing but c is a procedure oriented programing.c is super set of c++. c can’t suport inheritance,function overloading, method overloading etc. but c++ can do this.In c-programe the main function could not return a value but in the c++ the main function shuld return a value.
WHAT IS THE USE OF PUTCHAR FUNCTION?
The putchar function displays one character on the display monitor. The character to be displayed is of type char. The syntax for putchar function is as given below :putchar (ch_var); Where ch_var is a previously declared character variable.
WHAT IS THE USE OF GETCHAR FUNCTIONS?
The getchar function accepts a single character from the keyboard. The function does not require any arguments, though a pair of empty parentheses must follow the word getchar as a syntax. It returns a single character from a standard input device (typically a keyboard ) and it can be assigned to predeclared character variable.
WHAT IS CHARACTER CONSTANTS?
A character constant is a single character, enclosed within the pair of single quotation mark (apostrophes).
WHAT IS STRING CONSTANTS?
A string constant or literal contains a sequence of zero or more characters or escape seauences enclosed in double Quotation marks.
WHAT IS INTEGER CONSTANTS?
An integer constant is an integer-valued number. It can represent decimal, octal, or hexadecimal values.
WHAT IS FLOATING POINT CONSTANTS?
Floating-point constants are numbers with decimal parts. A floating-point constants consists of :
- An integral part
- A decimal point
- A fractional part
- An exponent part
- An optional suffix
WHAT IS THE DIFFERENCE BETWEEN FREAD AND FWRITE FUNCTION?
The fread() function returns the number of items read. This value may be less than count if the end of the file is reached or an error occurs. The fwrite() function returns the number of items written. This value will equal count unless an error occurs.
Hi There,
ReplyDeleteBrilliant article, glad I slogged through the C INTERVIEW QUESTIONS
it seems that a whole lot of the details really come back to from my past project.
I have a custom field on my Account object, say 'refered_by__c'. This field contains the ID of another Account object.
I want to write a SOQL something like this (psedu query):
select id, name, refered_by__c, from account
Please advise how can I write this query using SOQL.
By the way do you have any YouTube videos, would love to watch it. I would like to connect you on LinkedIn, great to have experts like you in my connection (In case, if you don’t have any issues).
Kind Regards,
Preethi.