C FAQ’S Collected from the students who attended technical round in TCS recruitment.

Slides:



Advertisements
Similar presentations
Question Bank. Explain the syntax of if else statement? Define Union Define global and local variables with example Concept of recursion with example.
Advertisements

Computer Programming for Engineering Applications ECE 175 Intro to Programming.
C Structures What is a structure? A structure is a collection of related variables. It may contain variables of many different data types---in contrast.
Dynamic memory allocation
Dynamic Memory Allocation in C.  What is Memory What is Memory  Memory Allocation in C Memory Allocation in C  Difference b\w static memory allocation.
The University of Adelaide, School of Computer Science
Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Chapter 9 Pointers and Dynamic Arrays. Overview 9.1 Pointers 9.2 Dynamic Arrays.
David Notkin Autumn 2009 CSE303 Lecture 13 This space for rent.
Programming and Data Structure
C Structures Basics of structures Typedef. Data Hierarchy Byte –8 bits (ASCII character ‘A’ = ) Field –Group of characters (character string “Fred”)
Unions The storage referenced by a union variable can hold data of different types subject to the restriction that at any one time, the storage holds data.
1 Lecture 4: Procedure Calls Today’s topics:  Procedure calls  Large constants  The compilation process Reminder: Assignment 1 is due on Thursday.
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.
SPLINT STATIC CHECKING TOOL Sripriya Subramanian 10/29/2002.
The University of Adelaide, School of Computer Science
Kernighan/Ritchie: Kelley/Pohl:
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
ISBN Chapter 10 Implementing Subprograms.
Memory Arrangement Memory is arrange in a sequence of addressable units (usually bytes) –sizeof( ) return the number of units it takes to store a type.
Run time vs. Compile time
1 CS 201 Dynamic Data Structures Debzani Deb. 2 Run time memory layout When a program is loaded into memory, it is organized into four areas of memory.
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
Overview Working directly with memory locations is beneficial. In C, pointers allow you to: change values passed as arguments to functions work directly.
 Introduction Introduction  Types of Function Types of Function  Library function Library function  User defined function User defined function 
CS3012: Formal Languages and Compilers The Runtime Environment After the analysis phases are complete, the compiler must generate executable code. The.
Runtime Environments Compiler Construction Chapter 7.
Functions, Pointers, Structures Keerthi Nelaturu.
 200 Total Points ◦ 74 Points Writing Programs ◦ 60 Points Tracing Algorithms and determining results ◦ 36 Points Short Answer ◦ 30 Points Multiple Choice.
Introduction to Data Structures Systems Programming.
17. ADVANCED USES OF POINTERS. Dynamic Storage Allocation Many programs require dynamic storage allocation: the ability to allocate storage as needed.
Dynamic Memory Allocation Conventional array and other data declarations An incorrect attempt to size memory dynamically Requirement for dynamic allocation.
Chapter 5: Programming Languages and Constructs by Ravi Sethi Activation Records Dolores Zage.
Data Structures and Algorithms Stacks. Stacks are a special form of collection with LIFO semantics Two methods int push( Stack s, void *item ); - add.
Comp 245 Data Structures Linked Lists. An Array Based List Usually is statically allocated; may not use memory efficiently Direct access to data; faster.
Chapter 0.2 – Pointers and Memory. Type Specifiers  const  may be initialised but not used in any subsequent assignment  common and useful  volatile.
1 Program Layout in memory –Code –Data Global variables –Stack Local variables & function Invocation Frames –Heap Dynamically allocated memory Today’s.
14/3/02 Sudeshna Sarkar, CSE, IIT Kharagpur1 Structures, ADT Lecture 25 14/3/2002.
C Functions Pepper. Objectives Create functions Function prototypes Parameters – Pass by value or reference – Sending a reference Return values Math functions.
COMPILERS Symbol Tables hussein suleman uct csc3003s 2007.
Basic Semantics Associating meaning with language entities.
Introduction to Data Structures Systems Programming Concepts.
Functions in C CSE 2451 Rong Shi. Functions Why use functions? – Reusability Same operation, different data – Abstraction Only need to know how to call.
 200 Total Points ◦ 75 Points Writing Programs ◦ 60 Points Tracing Algorithms and determining results ◦ 35 Points Short Answer ◦ 30 Points Multiple Choice.
CS415 C++ Programming Takamitsu Kawai x4212 G11 CERC building WV Virtual Environments Lab West Virginia University.
Functions. Motivation What is a function? A function is a self-contained unit of program code designed to accomplish a particular task. We already used.
C LANGUAGE Characteristics of C · Small size
EEL 3801 C++ as an Enhancement of C. EEL 3801 – Lotzi Bölöni Comments  Can be done with // at the start of the commented line.  The end-of-line terminates.
CNG 140 C Programming (Lecture set 12) Spring Chapter 13 Dynamic Data Structures.
ENEE150 – 0102 ANDREW GOFFIN Dynamic Memory. Dynamic vs Static Allocation Dynamic  On the heap  Amount of memory chosen at runtime  Can change allocated.
By Anand George SourceLens.org Copyright. All rights reserved. Content Owner - Meera R (meera at sourcelens.org)
Constructs for Data Organization and Program Control, Scope, Binding, and Parameter Passing. Expression Evaluation.
MORE POINTERS Plus: Memory Allocation Heap versus Stack.
Sudeshna Sarkar, CSE, IIT Kharagpur1 Structure and list processing Lecture
Tarik Booker CS 242. What we will cover…  Functions  Function Syntax  Local Variables  Global Variables  The Scope of Variables  Making Functions.
Runtime Environments Chapter 7. Support of Execution  Activation Tree  Control Stack  Scope  Binding of Names –Data object (values in storage) –Environment.
Lecture 7 Macro Review Stack Frames
Function: Declaration
Introduction to Computers Computer Generations
C Interview Questions Prepared By:.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
A bit of C programming Lecture 3 Uli Raich.
CSC 253 Lecture 8.
CS 2308 Final Exam Review.
CSC 253 Lecture 8.
The University of Adelaide, School of Computer Science
Chapter 9: Pointers and String
point when a program element is bound to a characteristic or property
CS 2308 Final Exam Review.
Presentation transcript:

C FAQ’S Collected from the students who attended technical round in TCS recruitment

How much you rate yourself in C out of 10 Difference between Compiler and Interpreter What is the basic structure of C program

What is the use of define section in C Program. Purpose of macros What is the difference between defining a variable and declaring a variable. What is the size of int in different operating systems.

Difference between scanf() and printf() Difference between %s and %c Program for Swapping without 3rd variable What is Type casting

Some programs using if else statements Program to find the factorial of a given number and using recursion also Program to print Fibonacci numbers up to 100 Program to print prime numbers from 1 to 100 Program to find nth prime number

Program for perfect number Program to find the reverse of the given number Program to convert numbers into words Program to generate household current bill

Some questions on Operator precedence What is the difference between void main() and int main() Is void a data type Program to print 24-hour Digital Clock Write a program using Define keyword

Program to read an array and print it Different types of storing a string into a variable There are three words – Ramesh, suresh, raghav. Print these words in dictionary order Program for string palindrome Concatenation of strings What is the difference between strcpy() and memcpy()

What is a pointer Uses of pointers Can we add or multiply pointers How to pass pointers as arguments to functions How do you print an address

Definitions of functions Different parameter passing mechanisms Difference between Call by Value and Call by reference Swapping using call by reference

What is function overloading Some programs on recursion ex: factorial of the given number sum of all digits in the given number Fibonacci series gcd of given 2 numbers Some questions on Storage classes

Difference between static memory allocation and dynamic memory allocation Different Memory allocation functions Difference between malloc() and calloc() Difference between malloc and new

What is Structure. Difference between structure and Union. Difference between Arrays and structures Tell something about Bit fields Difference between structure and class What is the purpose of using typedef

Types of Sorting and Searching techniques Write a program for Bubble sort What is Heap Explain Heap sort with an example Write quick sort algorithm Program for Binay search

What is Stack. Why it is called LIFO Difference between Stack and Queue Give the structure which represents a Node in the linked list Write code to create a SLL.

Differentiate between C and C++ Explain in detail about Compilation phases For greater productivity what would you prefer C or C++ What are the differences between Procedure oriented and object oriented languages Can we create a function in place of SCANF Types of errors you have experienced in your Project