c language basics questions and answers pdf Monday, December 14, 2020 3:54:35 AM

C Language Basics Questions And Answers Pdf

File Name: c language basics questions and answers .zip
Size: 1619Kb
Published: 14.12.2020

Top C Programming Interview Questions you Need to Master in 2021

C is the general and basic programming language that will create a base for other programming languages. C programming language was designed by Dennis Ritchie in Bells Lab.

And it appeared around 46 years ago which is in and it was stably established on 11 December It is a crucial language of computer and it is coded in assembly language and it can run on from supercomputers to the embedded systems. The initialization of static variable Countis performed only at the first instance of the function call. In successive calls to the function, the variable count retains its previous value.

However, these static variables are not accessible from other parts of the program. C language allows the use of the prefix register in primitive variable declarations. Such variables are called register variables and are stored in the registers of the microprocessor. The number of variables which can be declared register are limited. If more variables are declared register variables, they are treated as auto variables.

A program that uses register variables executes faster as compared to a similar program without register variables. It is possible to find out the allocation of register variables only by executing and comparing the performance with respect to the time taken by the program perceptible in large programs.

It is the responsibility of the compiler to allow register variables. In case the compiler is unable to do so, these variables are treated as auto variables. Loop indices, accessed more frequently, can be declared as register variables. For example, index is a register variable in the program given below. A structure is a composite data type declaration that defines a physically grouped list of variables to be placed under one name in a block of memory, allowing the different variables to be accessed via a single pointer.

Defining a structure in C: In C language a structure is defined using struct keyword followed by variable or pointer name below is the basic syntax for declaring a structure in C language. All variables declared within a function are auto by default. The extent of a variable is defined by its scope.

Variables declared auto can only be accessed only within the function or the nested block within which they are declared.

They are created when the block is entered into and destroyed when it is exited. Global Static variables are global to the file in which they are defined. They are used when the same global variable is referenced in each of the files and these variables must be independent of each other across the files. The use of global variables is not recommended, as function independence is one of the basic idea of modular programming.

Global variables should be used only when it is inevitable i. When program spans across different files and we want to have a global variable accessible to all functions in these files, the keyword extern should be used before the data type name in the declarations in all these files where it is accessed except one. The linker requires that only one of these files have the definition of the identifier. Global variables definitions can occur in one file only. Upon encountering the above statement, the compiler knows that an integer globalVar exists.

It goes ahead to produce the object file. In the file mainfile. This is because a declaration such as the one shown above tells the compiler that the integer globalVar is exported and can be accessed in different files. The linker is then invoked to link the two object together.

So, it includes the information in the locations in the object file where the global variable is accessed. In the object file of mainfile. When the linker links these two object files together, it knows the location of globalVar from the object file of mainfile. The difference between these two is the location the compiler searches for the header file to be included. If the file name is enclosed in quotes, the compiler searches in the same directory in which the file is included.

This method is normally used to include programmer defined headers. If the file name is enclosed in brackets which are used for standard library headers; the search is performed in an implementation dependent manner, normally through pre-designated directories. Derived data types are object types which are aggregates of one or more types of basic data types. The preprocessor provides the ability for the inclusion of header files, macro expansions, conditional compilation, and line control.

Recursion: A function, which calls itself, recursion is simple to write in program but takes more memory space and time to execute. Enumerated types are used to define variables that can only assign certain discrete integer values throughout the program.

In other words, a block is a compound statement. For example, a function body is a block, because it is simply a sequence of statements enclosed within curly braces. Blocks of statements in if statements and loops. All these blocks of statements actually follow the same rules. Consider the example shown below, the variable j declared in both main and the user defined function other func.

Accessing j uses the local declaration in the called function. The variables defined can be accessed only within the block in which they are declared. In cases of nested blocks, the variables declared in the outer blocks are accessible by statements in the inner blocks, and not vice-versa. These variables are called local variables because they are localized to the block. It helps to prevent the integrity of data data of one function cannot be modified by another function, directly.

It can be observed that if two variables of the same name are declared in many functions, they are distinct and unrelated variables. The scope of the variables in the function parameter list is also confined to the function, i. Continue is a jump statement that transfers control back to the beginning of the loop, bypassing any statements that are not yet executed. It can be used only in an iteration statement. Bit fields are used to store multiple, logical, neighboring bits, where each of the sets of bits and single bits can be addressed.

Also, we should make a pointer NULL when memory pointed by it is deallocated in the middle of a program. Main Function is the function where every C program begins executing. The printf is a library function that prints output. Pointers are variables that are used to store addresses. There are several easy ways to write programs without pointers, but in case of dynamic memory allocation, the knowledge of pointers is a must.

Knowing about memory locations and addresses defined will enable you with the ideas of how every variable function in a program. One can determine the exact size of a data type by using the sizeof operator.

Normalization is the process by which an address is converted to a form such that if two non-normalized pointers point to the same address, they both are converted to normalized form, thereby having a specific address. Flag values are used to make decisions between two or more options during the execution of a program.

Generally, flag values are small often two and it tries to save space by not storing each flag according to its own data type. The best way to store flag values is to keep each of the values in their own integer variable.

If there are large number of flags, we can create an array of characters or integers. We can also store flag values by using low-order bits more efficiently. Bit masking refers to selecting a particular set of bits from the byte s having many values of bits. Bit masking is used to examine the bit values and can be done by 'AND' operation of byte, bitwise.

As pointers have access to a particular memory location, the security level decreases and restricted memory areas can be accessed. Other demerits include memory holes, process and memory panics, etc. It is because the size of the structure depends on the fields which can be variable as set by the user. Void pointer is a generic pointer in programming. If the pointer type is unknown, we make use of the void pointer. Sometimes the task we are required to do might not fit in the allocated data and code segments.

Far pointers help to access rest of the memory inside a program. Far pointers are the information present outside the data segment generally 64 kb. Such pointers are used when we need to access an address outside of the current segment. AVL tree is a binary search tree where the node difference of heights in either the right and left subtrees is less than or equal to one.

Three developers by name Adelson, Velskii and Landi developed the technique for balancing the binary trees height. From the first letter of their names, AVL came to be. AVL tree has advantages such as low time complexity in inserting and deleting operations. An array is a collection of the same data items, which are stored in a contagious memory location.

Thank you. Constant Pointer is the one who cannot change the address they are pointing to. This means that suppose there is a pointer that points to a variable or stores the address of that variable. The constant variable is a value that can not be altered throughout the program. A storage location paired with an associated symbolic name has a value.

It is similar to a variable but cannot be modified once defined. It is sometimes known as a controlled variable. It is used in every scientific experiment that is helpful to understand the conclusions of an experiment. It can be initialized only once.

C programming Basic Questions and Answers (Pdf)-Part01

There are actually two ways you can do this. Likewise, the statement "x --" means to decrement the value of x by 1. When using Call by Value, you are sending the value of a variable as parameter to a function, whereas Call by Reference sends the address of the variable. Also, under Call by Value, the value in the parameter is not affected by whatever operation that takes place, while in the case of Call by Reference, values can be affected by the process within the function. How does this aid in debugging? The idea is that if the code is in fact correct, you simply remove the comment symbols and continue on.


Frequently asked c programming language interview questions and answers for freshers and 2 years experienced 3 years, 4 years, 5 years and 6 years. - 1.


PDF: C Programming Questions and Answers | C Language

What is a pointer? A pointer is a special variable, which stores the memory address. Ampersand in front of a variable gets its address and asterisk in front of a pointer gets its value. What is null pointer?

C Proramming MCQ : C is still the popular programming language and is favorite topics to test knowledge of a candidate on knowledge of programming concept. Please find the selected list of important mcq questions on C Programming Language with answer.

C Programming Questions and Answers

Who is father of C Language? Bjarne Stroustrup B. Dennis Ritchie C. James A. Gosling D. Codd Answer : B 2.

Dear readers, these C Programming Interview Questions have been designed specially to get you acquainted with the nature of questions you may encounter during your interview for the subject of C Programming. It de-refers twice to point to the data held by the designated pointer variable. By default every local variable of the function is automatic auto.

Top 100 C Programming Interview Questions & Answers

In this C Multiple Choice Questions and Answers section you can learn and practice C Multiple Choice Questions and Answers to improve your skills in order to face technical inerview conducted by Banks. By Practicing these interview questions, you can easily crack any Bank Exams interview. Fully solved examples with detailed answer description.

C is a mid-level and procedural programming language. The Procedural programming language is also known as the structured programming language is a technique in which large programs are broken down into smaller modules, and each module uses structured code. This technique minimizes error and misinterpretation. More details.

To browse Academia. Skip to main content. By using our site, you agree to our collection of information through the use of cookies.

Но сообщать имена жертв… с точки зрения человека в очках в металлической оправе, это было признаком особой элегантности стиля. Его пальцы снова задвигались, приводя в действие сотовый модем, и перед глазами появилось: СООБЩЕНИЕ ОТПРАВЛЕНО ГЛАВА 26 Сидя на скамейке напротив городской больницы, Беккер думал о том, что делать. Звонки в агентства услуг сопровождения ничего не дали.

3 Comments

Folkmotere 15.12.2020 at 20:39

C questions and answers.

Chad G. 18.12.2020 at 14:06

The routledge dictionary of english language studies pdf the divine name jonathan goldman pdf

Covadonga A. 23.12.2020 at 07:32

C is the general and basic programming language that will create a base for other programming languages.

LEAVE A COMMENT