Publish Events & Email Alerts

Subscribe our email alerts and Publish your events with us

You'll Receive & Get Benefits :

Publish & Subscribe

 Technicalsymposium

C Materials Free Download

What is the use of volatile keyword?

The modifier ‘volatile’ tells the compiler that a variable’s value may be changed in ways not explicitly specified by the program. For example, a global variable’s address may be passed to the operating system’s clock routine and used to hold the system time. In this situation, the contents of the variable are altered without any explicit assignment statements in the program. This is important because most C compilers automatically optimize certain expressions by assuming that a variable’s content is unchanging if it does not occur on the left side of an assignment statement. Thus, it may not be reexamined each time it is referenced. Also, some compilers change the order of evaluation of an expression during the compilation process. The volatile modifier prevents these changes. Download C & Data Structure Interview questions asked by top MNCs in 2018 ? 

4. Write a C program without using semicolon to print ‘Hello world’

void main(){

if(printf("Hello world")){

}

}

5. What are differences between sizeof operator and strlen function?

sizeof is keyword of C that can find size of a String constant including null character, but strlen is function which has been defined string.h and can find number of characters in a string excluding null character. 

#include

void main(){

int a,b;

a=strlen("cquestionbank");

b=sizeof("cquestionbank");

printf("%d %d",a,b);

getch();

}

6. What is the difference between 

sprintf(…) writes data to the character array. The C library function sprintf () is used to store formatted data as a string. You can also say the sprintf () function is used to create strings as output using formatted data. The syntax of the sprintf () function is as follows: 

int sprintf (char *string, const char *form, … );

Here, the *string will stand for the name of the array that will store the output obtained by working on the formatted data. The *form parameter will show the format of the output. 

printf(…) writes data to the standard output device. The printf function is just a useful function from the standard library of functions that are accessible. 

The behavior of printf is defined in the ANSI standard. If the compiler that you’re using conforms to this standard then all the features and properties should be available to you. 

7. When does the compiler not implicitly generate the address of the first element of an array?

The compiler does not implicitly generate the address of the first element of an array whenever an array name appears:

– as an operand of the sizeof operator

– as an operand of & operator

– as a string literal initialize for a character array

8. Is using exit() the same as using return?

No, the exit() function is used to exit your program and return() controls the operating system.

9. What is an lvalue?

An lvalue is an expression to which a value can be assigned. The lvalue expression is located on the left side of an assignment statement whereas an rvalue is located on the right side of an assignment statement. 

Each assignment statement must have an lvalue and an rvalue. The lvalue expression must refer a storable variable in memory. It cannot be a constant. 

10. What is the difference between goto, longjmp() and setjmp()?

• A goto statement implements a local jump of program execution whereas the longjmp() and setjmp() functions implement a nonlocal or far jump of the program execution. 

• Generally, a jump in any execution should be avoided because it is not considered good programming practice to use such statements as goto and longjmp in your program. 

• A goto statement simply bypasses code in your program and jumps to a predefined position. To use the goto statement, you give it a labeled position to jump to. This predefined position must be within the same function. You cannot implement goto between functions. 

However, when your program calls setjmp(), the current state of your program is saved in a structure of type jmp_buf. Later, your program can call the longjmp() function to restore the program’s state as it was when you called setjmp().Unlike the goto statement, the longjmp() and setjmp() functions do not need to be implemented in the same function. 

There is a major drawback of using these functions: your program, when restored to its previously saved state, it will lose its references to any dynamically allocated memory between the longjmp() and the setjmp(). This means you will waste memory for every malloc() or calloc() you have implemented between your longjmp() and setjmp(), and your program will be inefficient. 

It is highly recommended that you avoid using functions such as longjmp() and setjmp() because they, like the goto statement, are quite often an indication of poor programming practice. 

11. What is XOR linked list?

XOR linked list is a Memory Efficient Doubly Linked List. An ordinary Doubly Linked List requires space for two address fields to store the addresses of previous and next nodes. A memory efficient version of Doubly Linked List can be created using only one space for address field with every node. This memory efficient Doubly Linked List is called XOR Linked List or Memory Efficient as the list uses bitwise XOR operation to save space for one address. 

In the XOR linked list, instead of storing actual memory addresses, each node stores the XOR of addresses of previous and next nodes. 

XOR List Representation:

Let us call the address variable in XOR representation npx (XOR of next and previous)

Node A:

npx = 0 XOR add(B) // bitwise XOR of zero and address of B

Node B:

npx = add(A) XOR add(C) // bitwise XOR of address of A and address of C

Node C:

npx = add(B) XOR add(D) // bitwise XOR of address of B and address of D

Node D:

npx = add(C) XOR 0 // bitwise XOR of address of C and 0

12. What is ‘trie’ in data structure?

Trie is efficient information retrieval data structure. Using trie, search complexities can be brought to optimal limit (key length). If we store keys in binary search tree, a well balanced BST will need time proportional to M * log N, where M is maximum string length and N is number of keys in tree. 

• Using trie, we can search the key in O(M) time. However, the penalty is on trie storage requirements.

• Each node of trie consists of multiple branches. Each branch represents a possible character of keys.

• We need to mark the last node of every key as leaf node.

• A trie node field value will be used to distinguish the node as leaf node (there are other uses of the value field).

• A simple structure to represent nodes of English alphabet can be as follows:

struct trie_node

{

int value; /* Used to mark leaf nodes */

trie_node_t *children[ALPHABET_SIZE];

};

13. What do you understand by splay tree?

Splay tree is a self-balancing Binary Search Tree (BST). The main idea of splay tree is to bring the recently accessed item to root of the tree. This makes the recently searched item to be accessible in O (1) time if accessed again. The idea is to use locality of reference (In a typical application: 80% of the access are to 20% of the items). Imagine a situation, where we have millions or billions of keys and only few of them are accessed frequently, which is very likely in many practical applications. All splay tree operations run in O(log n) time on average, where n is the number of entries in the tree. Any single operation can take Theta(n) time in the worst case. 

14. What is Treap?

Treap is a Balanced Binary Search Tree, but not guaranteed to have height as O(Log n). The idea is to use Randomization and Binary Heap property to maintain balance with high probability. The expected time complexity of search, insert and delete is O(Log n). 

–>Each node of Treap maintains two values.

1. Key follows standard BST ordering (left is smaller and right is greater)

2. Priority Randomly assigned value that follows Max-Heap property.

15. How to implement LRU caching scheme? What data structures should be used?

We are given total possible page numbers that can be referred. We are also given cache (or memory) size (Number of page frames that cache can hold at a time). The LRU caching scheme is to remove the least recently used frame when the cache is full and a new page is referenced which is not there in cache. 

–>We use two data structures to implement an LRU Cache.

1. A Queue: which is implemented using a doubly linked list. The maximum size of the queue will be equal to the total number of frames available (cache size). 

The most recently used pages will be near front end and least recently pages will be near rear end. 

2. A Hash: with page number as key and address of the corresponding queue node as value. When a page is referenced, the required page may be in the memory. If it is in the memory, we need to detach the node of the list and bring it to the front of the queue. 

If the required page is not in the memory, we bring that in memory. In simple words, we add a new node to the front of the queue and update the corresponding node address in the hash. If the queue is full, i.e. all the frames are full, we remove a node from the rear of queue, and add the new node to the front of queue. 16. Suppose, there are two linked lists: L1 and L2 (of same lengths) that intersect at a particular node N1, which is a common endpoint to all other nodes. What are the possibilities to find N1? Linear solution is possible. Have two pointers say P1 pointing to the first node of L1 and P2 to that of L2. Traverse through both the lists. If P1 reaches L1’s last node, point it to the first node of L2 and continue traversing. Do the same thing for P2 when it reaches L2’s last node. (By doing this, we are balancing the difference in the length between the linked lists. The shorter one will get over soon and by redirecting to longer list’s head, it will traverse the extra nodes also). Finally, they will meet at the Intersection node. 

17. Given two keys K1 & K2, write an algorithm to print all the elements between them with K1<=K2 in a BST.

• Linear solution is possible without using any extra space.

• Perform an inorder traversal.

• Once you find K1, print it and continue traversal now.

• Print all other traversed elements until you reach K2.

18. How many stacks are required to implement a Queue.

Two stacks are required to implement a Queue.

• For Enqueue: Take two stacks S1 and S2 and perform push on S1.

• For Dequeue: If S2 is empty, pop all the elements from S1 and push it to S2. The last element you popped from S1 is an element to be dequeued. If S2 is not empty, then pop the top element in it. 

1.Write a c program to print Hello world without using any semicolon.

2.Swap two variables without using third variable.

3.What is dangling pointer in c?

4.What are merits and demerits of array in c?

5. Do you know memory representation of int a = 7 ?

6.What is and why array in c?

7.Why we use do-while loop in c? Also tell any properties which you know?

8.What is the meaning of prototype of a function?

9.Write a c program to modify the constant variable in c?

10.What is pointer to a function?

11.Write a c program to find size of structure without using sizeof operator?

1. What is C language?

2. What are the features of C language?

3. What is the use of printf() and scanf() functions?

4. What is the use of static variable in C?

5. What is recursion in C?

6. What is a stack?

7. What is a sequential access file?

8. What is spaghetti programming?

9. What is the difference between the = symbol and == symbol?

10. What is a nested loop?

11. What is syntax error?

12. When is the “void” keyword used in a function?

13. What are compound statements?

14. How do you generate random numbers in C?

15. What is debugging?

16. Can the “if” function be used in comparing strings?

17. What are reserved words?

18. What is FIFO?

19. What are binary trees?

20. What is an endless loop?

21. What are actual arguments?

22. What are run-time errors?

23. What is output redirection?

24. What are control structures?

25. What are enumerated types?

26. What are multidimensional arrays?

27. What are structure types in C?

28. What are the different data types in C?

29. What are pointers?

30. What is gets() function?

31. What is NULL pointer in C?

32. What is dynamic memory allocation?

33. What is auto keyword in C?

34. What is token?

35. What is new line escape sequence?

36. What is typecasting?

37. What is infinite loop?

64) When would you use a pointer to a function?

Pointers to functions are interesting, when you pass them to other functions. A function that takes function pointers says, in effect, "Part of what I do can be customized. Give me a pointer to a function, and I'll call it when that part of the job needs to be done. That function can do its part for me. This is known as a callback". It's used a lot in graphical user interface libraries, in which the style of a display is built into the library but the contents of the display are part of the application. 

65) How to return two variables of different data type from a function?

struct STRUCTURE

{

int integerVar;

char characterVar;

};

STRUCTURE Function()

{

STRUCTURE x;

return (x);



66) What is the difference between far pointer and near pointer ?

Compilers for PC compatibles, use two types of pointers.

• Near pointers are 16 bits long and can address a 64KB range. Far pointers are 32 bits long and can address a 1MB range. Near pointers operate within a 64KB segment. There's one segment for function addresses and one segment for data. 

• Far pointers have a 16-bit base (the segment address) and a 16-bit offset. The base is multiplied by 16, so a far pointer is effectively 20 bits long. For example, if a far pointer had a segment of 0x7000 and an offset of 0x1224, the pointer would refer to address 0x71224. A far pointer with a segment of 0x7122 and an offset of 0x0004 would refer to the same address. 

67) When should a far pointer be used?

Sometimes, you can get away with using a small memory model in most of a given program. Somethings may not fit in your small data and code segments. When that happens, you can use explicit far pointers and function declarations to get at the rest of memory. A far function can be outside the 64KB segment, most functions are shoehorned into for a small-code model. (Often, libraries are declared explicitly far, so they'll work no matter what code model the program uses.) A far pointer can refer to information outside the 64KB data segment. Typically, such pointers are used with farmalloc() and such, to separately manage a heap from the rest of the data. 

68) Expand the following fragment of C code to make it more understandable ?

{char* x = *y ? *++*y : *++*z;} 

Code can be rewritten as

char *x;

if (*y != NULL)

{

(*y)++;

x = *y;

}

else

{

(*z)++;

x = *z;

}

69) Write a C program to print a semicolon without using any semicolon in the whole program?

#define SEMICOLON 59 

//59 is ASCII value of semicolon 

void main() 



if(printf("%c",SEMICOLON)) { 



}

70) How can you determine the size of an allocated portion of memory?

You can't. free() can, but there's no way for a program to know the use of method free()

71) Add your code in the program so that the given code block print 'unknown' ?

<...Add your code...>

if(a>10) printf("greater"); 

else if(a<10) printf("lesser"); 

else if(a==10) printf("equal"); 

else printf("unknown");

#define a b++ 

main()

{

int b = 10;

if(a>10) printf("greater"); 

else if(a<10) printf("lesser"); 

else if(a==10) printf("equal"); 

else printf("unknown");

}

Explanation: After macro expansion the code will be like this :

if(b++>5) printf("greater"); //5>5 : fail 

else if(b++<5) printf("lesser"); //6

72) Can math operations be performed on a void pointer?

No. Pointer addition and subtraction are based on advancing the pointer by a number of elements. By definition, if you have a void pointer, you don't know what it's pointing to, so you don't know the size of what it's pointing to. If you want pointer arithmetic to work on raw addresses, use character pointers. 

73) How many parameters should a function have?

There is no fixed guideline or limit to the number of parameters your functions can have. However, it is considered bad programming style for your functions to contain an abnormally high (eight or more) number of parameters. The number of parameters a function has also directly affects the speed at which it is called - the more parameters, the slower the function call.

Source: Contents are provided by Technicalsymposium Google Group Members. 
Disclaimer: All the above contents are provided by technicalsymposium.com Google Group members. 
Further, this content is not intended to be used for commercial purpose. Technicalsymposium.com is not liable/responsible for any copyright issues.


Government Jobs

All State and Central Government Jobs/Railway & Bank Jobs/Alll Competitive Exams-Complete Details.

Software Jobs

Entry Level Software & IT Jobs in Chennai/Bangalore & Leading Metro Cities-Complete Details.

Conference/Symposium

Engineering Colleges & University /Premier Institute (IIT/IIM/etc.,) Events Details.

Off-Campus/Walk-in

All Software Companies & Core Companies Off-Campus Interviews & Walk-in across India-Complete Details.

All Bank Jobs

All Government Bank & Private Bank Jobs-Complete Details.

Internships

All Companies Internships-Complete Details.

IBPS

Probationary Officers/Clerk and Management Trainees & All IBPS Exams/Syllabus-Complete Details.

GATE

All Branches Syllabus & Question Papers-Free Download.

IES-Exam

Indian Engineering Services Syllabus & Question.Papers-Complete Details.

Software Program

Top Programming Source Codes/Lab Manuals with Solutions-Complete Details

Anna University

B.E/B.Tech/M.E/M.Tech/MCA/MBA Latest Syllabus & Question Papers

Scholarships

All Central & State Govt Scholarships/ International Scholarships/Merit Scholarships Details.

Placement Papers

All Companies Placement Papers with Answers - Free Download of Materials

Aptitude

All Aptitude Test Topics with Answers-Complete Details & Free Download

Technical Round Interview

All Companies Technical Round Interview Asked Questions with Answers

Certifications

All Certifications Software & All Branches Certifications-Complete Details.

Group Discussion

Group Discussion Various Topics with Valid Points-Complete Details.

HR Round

All HR Round Questions and Answers/Tips & Do's and Don'ts of HR Round.

General Job

Job Interview Tips & Do's/Dont's/Dress Codes/Body Language-Complete Details.

Placement ebooks

All Companies Placement Materials with Answers-Complete Details.

Technical Round Tips

All Kind of Technical Round Interview Tips and Answers/ Do's and Don'ts

Resume

Resume Writing Tips/Do's & Don'ts-Complete Details.

Career Pages

All MNC Companies Career Pages & Current Openings-Complete Details.

Software Projects

All Software Projects with Source Codes-Free Download & Details.

GRE

GRE Exam Procedure and Complete Details.

TOEFL

TOEFL Exam Procedure and Complete Details.

IELTS

IELTS Exam Procedure and Complete Details

SAT

SAT Exam Procedure and Complete Details

GMAT

GMAT Exam Procedure and Complete Details

MS in USA

MS in USA Procedure and Complete Details

Civil Engineering

Civil Engineering Lecture Notes for All Universities & Lab Manuals for All Semester.-Free Download

Mechanical Engineering

Mechanical Engineering Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Automobile Engineering

Automobile Engineering Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Computer Science

Computer Science Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Information Technology

Information Technology Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

MBA

MBA Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Biotechnology

Biotechnology Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Biomedical

Biomedical Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Aeronautical Engineering

Aeronautical Engineering Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download

Chemical Engineering

Chemical Engineering Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Electronics & Communication

Electronics & Communication Engineering Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Electrical & Electronics

Electrical & Electronics Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

MCA

MCA Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

B.Sc

B.Sc All Branches (Maths/Physics/Computer Science/Electronics/etc.,)-Lecture Notes-Free Download

BCA

BCA Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

BBA

BBA Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

M.Sc

M.Sc All Branches (Maths/Physics/Computer Science/Electronics/etc.,)-Lecture Notes-Free Download

M.Com

M.Com Lecture Notes for All Universities & Lab Manuals for All Semester-Free Download.

Engineering Maths

All Semester Engineering Maths (M1/M2/M3/M4/etc.,) Lecture Notes-Free Download

Engineering EBooks

All Engineering Branches of ebooks Free Download-Complete Details.

Engineering Physics

All Semester Engineering Physics Lecture Notes-Free Download

GATE Preparation Books

All Branches of GATE Free Preparation eBooks-Free Download.

Engineering Chemistry

All Semester Engineering Chemistry Lecture Notes-Free Download

Software Companies Info

All Software Companies in India - Complete Details.

Admission

Foreign Universities All Course Admission Procedures-Complete Details.

Software Ebooks

All Programming Software free Eboooks-Free Download.

Web Hosting

All Web Hosting Procedure-Complete Details.