C Interview Questions Prepared By:.

Slides:



Advertisements
Similar presentations
CSE 105 Structured Programming Language (C)
Advertisements

Dynamic memory allocation
C Language.
Lectures 10 & 11.
Lecture 20 Arrays and Strings
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
This Time Pointers (declaration and operations) Passing Pointers to Functions Const Pointers Bubble Sort Using Pass-by-Reference Pointer Arithmetic Arrays.
Kernighan/Ritchie: Kelley/Pohl:
CS100A, Fall 1997, Lectures 221 CS100A, Fall 1997 Lecture 22, Tuesday 18 November Introduction To C Goal: Acquire a reading knowledge of basic C. Concepts:
‘C’ LANGUAGE PRESENTATION.  C language was introduced by Dennis Ritchie..  It is a programming language, which can make a interaction between user and.
C Programming Language tutorial Powered by:-
C FAQ’S Collected from the students who attended technical round in TCS recruitment.
Lecture No: 16. The scanf() function In C programming language, the scanf() function is used to read information from standard input device (keyboard).
Team Badass.  Dennis M. Ritchie  1967 He became an employee at Bell Labs  Mid 1960s BCPL was developed by Martin Richards for the Multics Project 
By: Mr. Baha Hanene Chapter 3. Learning Outcomes We will cover the learning outcome 02 in this chapter i.e. Use basic data-types and input / output in.
By Sidhant Garg.  C was developed between by Dennis Ritchie at Bell Laboratories for use with the Unix Operating System.  Unlike previously.
Constants Numeric Constants Integer Constants Floating Point Constants Character Constants Expressions Arithmetic Operators Assignment Operators Relational.
Arrays  Array is a collection of same type elements under the same variable identifier referenced by index number.  Arrays are widely used within programming.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
CSCI 3133 Programming with C Instructor: Bindra Shrestha University of Houston – Clear Lake.
Agenda Computer Languages How to Write a Simple C Program
Computer Organization and Design Pointers, Arrays and Strings in C Montek Singh Sep 18, 2015 Lab 5 supplement.
Files A collection of related data treated as a unit. Two types Text
Functions Chapter 5. Function A set of instructions that are designed to perform specific task. A complete and independent program. It is executed by.
BASIC C PROGRAMMING LANGUAGE TUTORIAL infobizzs.com.
INTRODUCTION TO PROGRAMING System Development Mansoura October 2015.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
C LANGUAGE UNIT 3. UNIT 3 Arrays Arrays – The concept of array – Defining arrays – Initializing arrays.
EGR 2261 Unit 11 Pointers and Dynamic Variables
Computer Organization and Design Pointers, Arrays and Strings in C
Lesson #8 Structures Linked Lists Command Line Arguments.
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Spring 2017
Strings CSCI 112: Programming in C.
UNIT 5 C Pointers.
Strings (Continued) Chapter 13
Program to search an element of array using linear search.
Storage class in C Topics Automatic variables External variables
Introduction to C++.
Prof: Dr. Shu-Ching Chen TA: Samira Pouyanfar Hector Cen Fall 2017
BY GAWARE S.R. COMPUTER SCI. DEPARTMENT
Pointers.
Module 2 Arrays and strings – example programs.
Introduction to C Programming Language
Arrays in C.
Visit for more Learning Resources
CSCI206 - Computer Organization & Programming
IDENTIFIERS CSC 111.
Storage.
Ken D. Nguyen Department of Computer Science Georgia State University
Object Oriented Programming COP3330 / CGS5409
Chapter 14 - Advanced C Topics
Pointers, Dynamic Data, and Reference Types
File I/O in C Lecture 7 Narrator: Lecture 7: File I/O in C.
Govt. Polytechnic,Dhangar
Pointers and Dynamic Variables
Govt. Polytechnic,Dhangar
COP 3330 Object-oriented Programming in C++
Dynamic Memory.
Arrays Arrays A few types Structures of related data items
The C Language: Intro.
Chapter 9: Pointers and String
C – Programming Language
Ken D. Nguyen Department of Computer Science Georgia State University
Variables in C Topics Naming Variables Declaring Variables
Course Outcomes of Programming In C (PIC) (17212, C203):
Pointers, Dynamic Data, and Reference Types
Storage classes in C In C language, each variable has a storage class which decides the following things: scope i.e where the value of the variable would.
Introduction to Pointers
Getting Started With Coding
Presentation transcript:

C Interview Questions Prepared By:

What is C? C is a programming language developed at Bell Labs by Dennis M. Ritchie. In 1972. Most of the Unix kernels are written in C.

2. What are the features of C programming language?. Simple Portable Mid level Structured Fast in speed Memory management Extensible

3. What is the use of printf() and scanf() functions? The printf() function is used to print the output of the program on the standard output device i.e. monitor or any other display unit. The scanf() function is used to take input from the user from a standard input device i.e. the keyboard.

4. What is local and global variable? A local variable can be defined as the variable which is defined inside a function. The lifetime of a local variable is only within the function. A global variable can be defined as the variable which is defined out side a function and inside a class. The lifetime of global variable is inside the whole program.

5. What is static variable in C? A static variable in C is the variable which retains it’s value inside a function. If a static variable is called many times from inside a function then it will be retained.

6. What are arrays in C? An array in C is the group of elements. All the elements in array are homogeneous.

7. What are the advantages of C? Code Optimization: Less code to the access the data Easy to traverse data: By using the for loop, we can retrieve the elements of an array easily. Easy to sort data: To sort the elements of array, we need a few lines of code only. Random Access: We can access any element randomly using the array.

8.  What is dangling pointer in C? If a pointer is pointing to a memory location and meanwhile some other pointer deletes the memory occupied by the first pointer and after deletion also the first pointer is pointing to the memory location then the first pointer is called as dangling pointer and this problem is known as dangling pointer problem.

9. What is Dynamic Memory Allocation? Dynamic memory allocation is a process of allocating the memory to the program at runtime.

10. What is structure? Structure is a user defined datatype that allows the user to store multiple data in a single unit element.

11.What is a null pointer? There are times when it's necessary to have a pointer that doesn't point to anything. The macro NULL, defined in <stddef.h>, has a value that's guaranteed to be different from any valid pointer. NULL is a literal zero, possibly cast to void* or char*. Some people, notably C++ programmers, prefer to use 0 rather than NULL.

12.When is a null pointer used? The null pointer is used in three ways: 1. To stop indirection in a recursive data structure. 2. As an error value. 3. As a sentinel value. 1. Using a Null Pointer to Stop Indirection or Recursion

13.Is NULL always defined as 0(zero)? NULL is defined as either 0 or (void*)0. These values are almost identical; either a literal zero or a void pointer is converted automatically to any kind of pointer, as necessary, whenever a pointer is needed (although the compiler can't always tell when a pointer is needed).

14.What is the difference between getch() and getche()? The getch() function reads a single character from keyboard. It doesn't uses any buffer, so entered data is not displayed on the output screen. The getche() function reads a single character from keyword but data is displayed on the output screen. Press Alt+f5 to see the entered character.

15.What is auto keyword in C? In C, every local variable of a function is known as automatic (auto) variable. Let's explain with an example: void f()   {   int i ;   auto int j;   }  

Thank You 