C Programming

[vc_row full_width=”stretch_row” css=”.vc_custom_1559286923229{background-color: #f6f6f7 !important;}”][vc_column width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”What is a pointer on pointer?” tab_id=”1559286383409-ab730398-6c03″][vc_column_text]It’s a pointer variable which can hold the address of another pointer variable. It de-refers twice to point to the data held by the designated pointer variable.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Distinguish between malloc() & calloc() memory allocation.” tab_id=”1559286522681-3bf94e12-e7b7″][vc_column_text]

Both allocates memory from heap area/dynamic memory. By default calloc fills the allocated memory with 0’s.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is keyword auto for?” tab_id=”1561382593569-b1979b66-b066″][vc_column_text]By default every local variable of the function is automatic (auto). In the below function both the variables ‘i’ and ‘j’ are automatic variables.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the valid places for the keyword break to appear.” tab_id=”1561382595833-dd54d407-26c0″][vc_column_text]

Break can appear only with in the looping control and switch statement. The purpose of the break is to bring the control out from the said blocks.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain the syntax for for loop.” tab_id=”1561382597303-5168678c-55b9″][vc_column_text]

When control reaches for expression-1 is executed first. Then following expression-2, and if expression-2 evaluates to non-zero ‘set of statements’ and expression-3 is executed, follows expression-2.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is difference between including the header file with-in angular braces < > and double quotes “ “” tab_id=”1561382598718-1fee5a6b-29dd”][vc_column_text]

If a header file is included with in < > then the compiler searches for the particular header file only with in the built in include path. If a header file is included with in “ “, then the compiler searches for the particular header file first in the current working directory, if not found then in the built in include path.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How a negative integer is stored.” tab_id=”1561382602352-48d936eb-64df”][vc_column_text]Get the two’s compliment of the same positive integer. Eg: 1011 (-5)

Step-1 − One’s compliment of 5 : 1010

Step-2 − Add 1 to above, giving 1011, which is -5[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a static variable?” tab_id=”1561382603416-a2e0c7df-e6f8″][vc_column_text]A static local variables retains its value between the function call and the default value is 0. The following function will print 1 2 3 if called thrice.

void f() { 
   static int i; 
   ++i; 
   printf(“%d “,i); 
}

If a global variable is static then its visibility is limited to the same source code.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a NULL pointer?” tab_id=”1561382604362-41fc1dd4-d143″][vc_column_text]

A pointer pointing to nothing is called so. Eg: char *p=NULL;

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the purpose of extern storage specifier?” tab_id=”1561382605426-bedbe54f-bb01″][vc_column_text]Used to resolve the scope of global symbol.

Eg:  
main() {
   extern int i;
   Printf(“%d”,i);
}

int i = 20;

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain the purpose of the function sprintf().” tab_id=”1561382606689-6de5471f-2224″][vc_column_text]

Prints the formatted output onto the character array.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the meaning of base address of the array?” tab_id=”1561382593038-8e7f1218-a7ac”][vc_column_text]

The starting address of the array is called as the base address of the array.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”When should we use the register storage specifier?” tab_id=”1561382592598-bfa5a635-55f4″][vc_column_text]

If a variable is used most frequently then it should be declared using register storage specifier, then possibly the compiler gives CPU register for its storage to speed up the look up of the variable.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”S++ or S = S+1, which can be recommended to increment the value by 1 and why?” tab_id=”1561382592102-02f6742f-af9d”][vc_column_text]

S++, as it is single machine instruction (INC) internally.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a dangling pointer?” tab_id=”1561382591605-a59a34b3-da74″][vc_column_text]

A pointer initially holding valid address, but later the held address is released or freed. Then such a pointer is called as dangling pointer.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the purpose of the keyword typedef?” tab_id=”1561382591221-5a07bad8-cf1f”][vc_column_text]

It is used to alias the existing type. Also used to simplify the complex declaration of the type.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is lvalue and rvalue?” tab_id=”1561382590677-cc47cbcf-ee26″][vc_column_text]

The expression appearing on right side of the assignment operator is called as rvalue. Rvalue is assigned to lvalue, which appears on left side of the assignment operator. The lvalue should designate to a variable not a constant.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between actual and formal parameters?” tab_id=”1561382590095-0dd9d5a4-e5bf”][vc_column_text]

The parameters sent to the function at calling end are called as actual parameters while at the receiving of the function definition called as formal parameters.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Can a program be compiled without main() function?” tab_id=”1561382589718-2e1a6ceb-a239″][vc_column_text]

Yes, it can be but cannot be executed, as the execution requires main() function definition.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the advantage of declaring void pointers?” tab_id=”1561382589333-47659694-5e1f”][vc_column_text]

When we do not know what type of the memory address the pointer variable is going to hold, then we declare a void pointer for such.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Where an automatic variable is stored?” tab_id=”1561382588926-dd3c13fa-09be”][vc_column_text]

Every local variable by default being an auto variable is stored in stack memory.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a nested structure?” tab_id=”1561382588517-7fc83786-ee5a”][vc_column_text]

A structure containing an element of another structure as its member is referred so.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the difference between variable declaration and variable definition?” tab_id=”1561382588060-9c018b10-4231″][vc_column_text]

Declaration associates type to the variable whereas definition gives the value to the variable.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a self-referential structure?” tab_id=”1561382587557-eee3186e-5475″][vc_column_text]

A structure containing the same structure pointer variable as its element is called as self-referential structure.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Does a built-in header file contains built-in function definition?” tab_id=”1561382583069-d03ea374-27b7″][vc_column_text]

No, the header file only declares function. The definition is in library which is linked by the linker.

[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][vc_column width=”1/2″][vc_tta_accordion color=”peacoc” active_section=”1″][vc_tta_section title=”Explain modular programming.” tab_id=”1561382561432-7f73ef2a-cc67″][vc_column_text]

Dividing the program in to sub programs (modules/function) to achieve the given task is modular approach. More generic functions definition gives the ability to re-use the functions, such as built-in library functions.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a token?” tab_id=”1561382561455-654071d3-eb53″][vc_column_text]

A C program consists of various tokens and a token is either a keyword, an identifier, a constant, a string literal, or a symbol.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a preprocessor?” tab_id=”1561382611424-56181e07-6453″][vc_column_text]

Preprocessor is a directive to the compiler to perform certain things before the actual compilation process begins.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain the use of %i format specifier w.r.t scanf().” tab_id=”1561382613753-7c9c9136-4ca1″][vc_column_text]

Can be used to input integer in all the supported format.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How can you print a \ (backslash) using any of the printf() family of functions.” tab_id=”1561382614729-6b63842b-62b1″][vc_column_text]

Escape it using \ (backslash).

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Does a break is required by default case in switch statement?” tab_id=”1561382615672-42dd66a8-6425″][vc_column_text]

Yes, if it is not appearing as the last case and if we do not want the control to flow to the following case after default if any.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”When to user -> (arrow) operator.” tab_id=”1561382616984-e392adb7-34cd”][vc_column_text]

If the structure/union variable is a pointer variable, to access structure/union elements the arrow operator is used.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are bit fields?” tab_id=”1561382618152-4fb6fc3a-9883″][vc_column_text]

We can create integer structure members of differing size apart from non-standard size using bit fields. Such structure size is automatically adjusted with the multiple of integer size of the machine.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are command line arguments?” tab_id=”1561382619930-3767e1f0-f3d6″][vc_column_text]The arguments which we pass to the main() function while executing the program are called as command line arguments. The parameters are always strings held in the second argument (below in args) of the function which is array of character pointers. First argument represents the count of arguments (below in count) and updated automatically by operating system.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are the different ways of passing parameters to the functions? Which to use when?” tab_id=”1561382620762-261798c4-b2da”][vc_column_text]

  • Call by value − We send only values to the function as parameters. We choose this if we do not want the actual parameters to be modified with formal parameters but just used.
  • Call by reference − We send address of the actual parameters instead of values. We choose this if we do want the actual parameters to be modified with formal parameters.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is the purpose of built-in stricmp() function.” tab_id=”1561382621738-44e10b8a-ca7d”][vc_column_text]

It compares two strings by ignoring the case.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Describe the file opening mode “w+”.” tab_id=”1561382622978-99f18b2d-fe4d”][vc_column_text]

Opens a file both for reading and writing. If a file is not existing it creates one, else if the file is existing it will be over written.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Where the address of operator (&) cannot be used?” tab_id=”1561382623945-e109c4d3-ece0″][vc_column_text]It cannot be used on constants.

It cannot be used on variable which are declared using register storage class.[/vc_column_text][/vc_tta_section][vc_tta_section title=”Is FILE a built-in data type?” tab_id=”1561382625642-843354b1-1f56″][vc_column_text]

No, it is a structure defined in stdio.h.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is reminder for 5.0 % 2?” tab_id=”1561382626563-0fa3f678-a5bf”][vc_column_text]

Error, It is invalid that either of the operands for the modulus operator (%) is a real number.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”How many operators are there under the category of ternary operators?” tab_id=”1561382627658-bb4ddb6b-277e”][vc_column_text]

There is only one operator and is conditional operator (? : ).

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which key word is used to perform unconditional branching?” tab_id=”1561382628592-dd61fe2e-19d3″][vc_column_text]

goto

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a pointer to a function? Give the general syntax for the same.” tab_id=”1561382630393-e350687e-823e”][vc_column_text]A pointer holding the reference of the function is called pointer to a function. In general it is declared as follows.

T (*fun_ptr) (T1,T2…); Where T is any date type.

Once fun_ptr refers a function the same can be invoked using the pointer as follows.

fun_ptr();
[Or]
(*fun_ptr)();

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Explain the use of comma operator (,).” tab_id=”1561382632977-3b296953-06eb”][vc_column_text]Comma operator can be used to separate two or more expressions.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a NULL statement?” tab_id=”1561382634764-ad5070ba-db90″][vc_column_text]A null statement is no executable statements such as ; (semicolon).

Eg: int count = 0; 
while( ++count<=10 ) ;

Above does nothing 10 times.[/vc_column_text][/vc_tta_section][vc_tta_section title=”What is a static function?” tab_id=”1561382636355-5dfe038c-83df”][vc_column_text]

A function’s definition prefixed with static keyword is called as a static function. You would make a function static if it should be called only within the same source code.

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which compiler switch to be used for compiling the programs using math library with gcc compiler?” tab_id=”1561382638762-3bfa136c-84a1″][vc_column_text]

Opiton –lm to be used as > gcc –lm <file.c>

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which operator is used to continue the definition of macro in the next line?” tab_id=”1561382649403-b75ce50f-0f5c”][vc_column_text]Backward slash (\) is used.

E.g. #define MESSAGE "Hi, \
   
Welcome to C"

[/vc_column_text][/vc_tta_section][vc_tta_section title=”Which operator is used to receive the variable number of arguments for a function?” tab_id=”1561382651188-733a0ad7-4f7c”][vc_column_text]Ellipses (…) is used for the same. A general function definition looks as follows

void f(int k,…)  {
}

[/vc_column_text][/vc_tta_section][vc_tta_section title=”What are enumerations?” tab_id=”1561382674843-1f0b68aa-358c”][vc_column_text]

Enumerations are list of integer constants with name. Enumerators are defined with the keyword enum.

[/vc_column_text][/vc_tta_section][/vc_tta_accordion][/vc_column][/vc_row][vc_row full_width=”stretch_row” overlay_color=”rgba(12,12,12,0.58)” css=”.vc_custom_1528340415800{padding-bottom: 104px !important;background-image: url(https://wordpresslms.thimpress.com/wp-content/uploads/sites/4/2017/06/layer-532.jpg?id=231) !important;background-position: center !important;background-repeat: no-repeat !important;background-size: cover !important;}” el_class=”overflow-visible become-teacher”][vc_column width=”1/2″][vc_column_text el_class=”align-right”]

Please login to send your request!
[/vc_column_text][/vc_column][vc_column width=”1/2″ el_class=”talk”][vc_column_text el_class=”thim-content-talk”]I’m a Copywriter in a Digital Agency, I was searching for courses that’ll help me broaden my skill set. Before signing up for Rob’s.[/vc_column_text][/vc_column][/vc_row]

WhatsApp us