2011 TCS Technical Interview Questions:1.What does static variable mean?

A static variable in C is one in which the memory is preallocated before the execution unit begins and lasts for the entire program unit. A non-static variable in C will be allocated in the block in which it is contained, and destroyed outside that block. there are 3 main uses for the static. 1. If you declare within a function: It retains the value between function calls 2.If it is declared for a function name: By default function is extern..so it will be visible from other files if the function declaration is as static..it is invisible for the outer files 3. Static for global variables: By default we can use the global variables from outside files If it is static global..that variable is limited to with in the file

What is a pointer?

Pointer is a user defined data type which creates special types of variables which can hold the address of primitive data type like char, int, float, double or user defined data type like function, pointer etc. or derived data type like array, structure, union, enum. Examples: int *ptr; int (*ptr)(); int (*ptr)[2];

In c programming every variable keeps two type of value. 1. Contain of variable or value of variable. 2. Address of variable where it has stored in the memory. (1) Meaning of following simple pointer declaration and definition: int a=5; int * ptr; ptr=&a; Explanation: About variable a: 1. Name of variable : a 2. Value of variable which it keeps: 5

3. Address where it has stored in memory : 1025 (assume) About variable ptr: 4. Name of variable : ptr 5. Value of variable which it keeps: 1025 6. Address where it has stored in memory : 5000 (assume) Pictorial representation:

Note: A variable where it will be stored in memory is decided by operating system. We cannot guess at which location a particular variable will be stored in memory. (2) Meaning of following pointer declaration and definition: int a=50; int *ptr1; int **ptr2; ptr1=&a; ptr2=&pt1; Explanation: About variable a:

& is know as reference operator which gives address where variable has stored in memory. Address where it has stored in memory : 5000 (assume) About variable ptr1: 4. Cancellation rule of above two operators: . Name of variable : ptr1 5.1. Value of variable which it keeps: 50 3. Name of variable : ptr2 8. Address where it has stored in memory : 9555 (assume) Pictorial representation declaration and definition: of above pointer Note: * is know as indirection operator which gives content of any variable. Address where it has stored in memory : 9000 (assume) About variable ptr2: 7. Value of variable which it keeps: 9000 9. Value of variable which it keeps: 5000 6. Name of variable : a 2.

**temp). //statement one int **temp=&ptr. *&p=p But it is not right to write: &*p=p Simple example: What will be output of following c program? #include<stdio. } Output: 25 25 25 Explanation: As we know value of variable x is 25.* and & operators always cancel to each other.h> int main(){ int x=25. *ptr= *(&x) //from statement one =*&x =x //using cancellation rule =25 **temp= **(&ptr)=*(*&ptr)=*ptr=*(&x)=*&x=x=25 %d %d”. i. .e. int *ptr=&x.x. //statement two printf(“%d return 0.*ptr.

Structures are slightly different from the variable types you have been using till now. Initializing a Structure . passing structure to functions. When you define a structure or union. structure within a structure and union. Structures are data types by themselves. 4. functions and structures. or group together different data into one object. The variables you declare inside the structure are called data members.Structures and Unions Author: Brian Moriya 2011 Published on: 25th May 2006 | Last Updated on: 17th Jul In this tutorial you will learn about C Programming . passing entire function to functions. you are creating a custom data type.Structures and Unions. Copyright exforsys. 5. }. 3. You can define a Structure as shown below: Sample Code 1. struct object { char id[20]. arrays of structure. int ypos.What is a structure? C Programming .com Structures can group data of different types as you can see in the example of a game object for a video game. 2. assigning values to members. Ads Structures Structures in C are used to encapsulate. initializing structure. int xpos.

xpos = 0.com Functions and Structures Since structures are of custom data types. and ypos equal to 0. player1. functions can return structures and also take them as arguments.ypos = 0. 3. 2. player1. To access the members of a structure.Structure members can be initialized when you declare a variable of your structure: Sample Code 1.” (scope resolution) operator. . you are making a copy of the structure and all it's members so it can be quite memory intensive. To return a structure from a function declare the function to be of the structure type you want to return. 0}. struct object player1 = {“player1”. 0. Shown below is an example of how you can accomplish initialization by assigning values using the scope resolution operator: Sample Code 1. you use the “. struct object createobj(char id[]. Copyright exforsys. 4. int ypos) { 2. Keep in mind that when you do this. struct object player1. Copyright exforsys.id = “player1”. player1. xpos equal to 0.com The above declaration will create a struct object called player1 with an id equal to “player1”. int xpos. 3. In our case a function to initialize our object structure might look like this: Sample Code 1. struct object newobj.

”. 4. int ypos. }. 7. printf(“y position: %d”.ypos = ypos. 6. int xpos. 3. } Copyright exforsys.c: Sample Code 1. 8. . 5. newobj. 9.id. 4. printf(“x position: %d. 5.id). printf(“n”).4. 7. newobj. } Copyright exforsys. ”.h> struct object { char id[20].com Pass Structure to a Function Let us now learn to pass a structure to a function. object1. void printobj(struct object obj) { printf(“name: %s. 6.xpos).ypos).xpos = xpos. strcpy(newobj.com For completeness we shall include the full source of the above examples so you may see how it all fits together. 2. obj. 2. name). obj. #include <stdio. return newobj. 3. obj. 8. 6. As an example let us use a function that prints members of the structure passed to it: Sample Code 1. 5.h> #include <stdlib.

14. } 22. 27. int ypos). printobj(enemy1). void printobj(struct object obj) { 32. 28.com • Structure questions with explanation in c (q) What will be output of following c code? . 0. printf("y position: %d". 34. 0). id). printf("name: %s. 23. obj. void printobj(struct object obj). } Copyright exforsys. 18. } 30. 19. ". printf("n"). strcpy(newobj. 11. obj.id. struct object newobj. 2.9. obj. 21. int ypos) { 24. return newobj.xpos = xpos. 10.id). 26. 36. newobj. printf("x position: %d. 33. 25. 20. 13. printobj(player1).ypos). 31. 16. struct object createobj(char id[].xpos). 12. newobj. 17. int xpos.ypos = ypos. int xpos. 29. ". 35. struct object enemy1 = createobj("enemy1". struct object createobj(char id[]. 3). void main() { 15. struct object player1 = createobj("player1".

1 bit for sex and 7 bit for age. clrscr().age). getch(). How bit data is stored in the memory: Minimum size of structure which data member in bit is two byte i.1. (q) What will be output of following c code? void main() { struct bitfield { unsigned a:5.emp1.emp1. Word size depends on microprocessor.id.3. } Output: 203 1 23 We can access the data member in same way. unsigned sex:1.emp1.3}. struct bitfield *ptr.bit1={1. Bits are filed in from right to left direction 8 bit for id.e.23}. Turbo c is based on 8086 microprocessor which word size is two byte. char *p.void main() { struct employee { unsigned id: 8. struct employee emp1={203. 16 bit. unsigned c:5. }. . }bit. unsigned age:7. printf("%d\t%d\t%d".sex. This is called word size of microprocessor. unsigned b:6.

Output: 12 Explanation: Binary value Binary value Binary value In memory it of of of is a=1 is 00001 (in 5 bit) b=3 is 00011 (in 5 bit) c=3 is 000011 (in 6 bit) represented as: Let address of bit1 is 500 which initialize to char pointer p. p++. clrscr(). getch(). clrscr(). printf("%d".*p). printf("%d". }.1}.sizeof(bit1)). unsigned int c:1. } Output: 4 (q) What will be output of following c code? void main() .14. getch().} p=&bit1. unsigned int b:13. (q) What will be output of following c code? void main() { struct bitfield { signed int a:3. struct bitfield bit1={2. *p means content of memory location 501 which is (00001100) and its binary equivalent is 12. Since can is one byte data type so p++ will be 501. Hence output is 12.

Output: 5 Note: (Actual output will 6 due to slack byte . *p=45.e. we can declare a structure within another structure but it . printf("\n%d".'A'}. getch(). char b. char b. printf("%d". getch(). } Output: 45 Nesting of structure: Nesting of structure is possible i. int d. clrscr().{ } struct bitfield { unsigned a:3. unsigned c:5. char *p=&bit1.So Before executing this program first go to option menu then compiler then code generation then select word alignment then press OK) (q) What will be output of following c code? void main() { struct field { int a. }bit. clrscr().a).sizeof(bit)). }bit. struct field bit1={5.bit1.

char b. printf("%d\t%c\t%c\t %f". . }.'A'. float d.d).'i'. getch().st.c.800000 (q) What will be output of following c code? void main() { struct india { char c. clrscr().p.b.st.st.8}.p. Example: void main() { struct world { int a.st. }p. struct world { int a[3]. }. float d. struct world st ={1. struct india { char c. char b. }. } Output: 1 A I 1.a.1.is necessary inner structure must declares structure variable otherwise we can not access the data member of inner structure. struct india orissa.

First.'P'.st.st. You can.2.st. Array items can be accessed by using its subscript whereas structure items can be accessed using its dot or "arrow" operator in C.a[1]. while calloc() needs two arguments. of course.'q'.orissa. other structures and arrays.struct world st ={{1. also have arrays of structures. is in the number of arguments. and JavaScript.c.b.3}. including.1. getch().d). clrscr(). Structures are complex data items made up of other data items.orissa.4}. Java. C#. } Output: 2 p q 1. diff between malloc() and calloc()? There are two differences. • In header files whether functions are declared or defined? • In header files the functions are declared not defined. C++.st. potentially.400000 • • What are the differences between structures and arrays? Arrays are collections of repeated data items. . Functions are defined in the library routines only. Malloc() takes a single argument (memory required in bytes). printf("%d\t%c\t%c\t %f".

• What are macros? what are its advantages and disadvantages? • Macros are preprocessor statements which will have specific set of instructions which are repeated in source code for several times and which wil be replaced at every call made. the length will be the product of its parameters. Any modification to instructions in macro reflects in every call 4. malloc() does not initialize the memory allocated. while calloc() initializes the allocated memory to ZERO. size_of_each_block). If it fails to locate enough space it returns a NULL pointer. 1. 3. • calloc() allocates a memory area. Every call will be replaced and hence internally code length will be large. • malloc() allocates a single block of memory of REQUSTED SIZE and returns a pointer to first byte.Secondly. ptr_var=(type *)calloc(n.e. If it fails to locate requsted amount of memory it returns a null pointer. Syntax: ptr_var=(cast_type *)malloc(Size_in_bytes). Prog more readable. Difference between pass by reference and pass by value? . Reduce source code length 2.s). i. No performance drawback by macros 1. calloc fills the memory with ZERO's and returns a pointer to first byte. Syntax: ptr_var=(cast_type *)calloc(no_of_blocks .

and retains its value between function calls.(Formal and Actual). a large number of variables in code are stored in memory. Changes made to formal will not affect the actual parameters. a variable declared as static in a function is initialised once. In dos.Here there will be temporary variable created in the function stack which does not affect the original variable. . you mean system. • • Where are the auto variables stored? if by "auto".it is useful when you required to return more then 1 values Pass By Value: .Same memory location is used for both variables. • What is static identifier? In C. you can type SET and press enter to see what system variables are set. The default initial value of an uninitialized static variable is zero.Different memory locations will be created for both variables. . If a function or global variable is declared static. just use SET <variable name>=<value>.In this method value of the variable is passed. . because using memory is faster. it can only be accessed in that file. Whatever changes made to the formal parameter will affect to the actual parameters . variables are stored in memory.Pass By Reference : In Pass by reference address of the variable is passed to a function. In fact. To store or replace a variable.

" "enumerator constants.removal of no. Access to `register' specified • indentifiers should be as fast as possible. the compiler is free to treat a `register' declaration as an `auto' declaration.removing or modifying any array element is very easy.s in linked list is related to this pointer direction & linking that no.linked list is a comlicated sequence of numbers." "enumerators. via a link which is nothieng but a pointer. so the compiler may place the value in a machine register.Compared to arrays .each number in the linked list is connected to its previous & next no. which is already present in the list. local. A variable with enumeration type stores one of the values of the enumeration set defined by that type. • Difference between arrays and linked list? Array is a simple sequence of numbers which are not concerned about eachothers positions. static.• • Where does global. An enumeration type declaration gives the name of the (optional) enumeration tag and defines the set of named integer identifiers (called the "enumeration set. free memory and C Program instructions get stored? These are all implementation defined. • What are enumerations? An enumeration consists of a set of named integer constants. Instructions are generally stored in code segement.Addition. . However. adding. they are independent of each-others positions. • Where free memory is maintained is an OS specific concept." or "members"). to the no. register variables.

Enumerations provide an alternative to the #define preprocessor directive with the advantages that the values can be generated for you and obey normal scoping rules. the storage associated with an enumeration variable is the storage required for a single int value. A type specifier of the form enum identifier { enumerator-list } declares identifier to be the tag of the enumeration specified by the enumerator-list nonterminal. The enumerator-list defines the "enumerator content. Since the enumeration type is defined elsewhere. An enumeration constant or a value of enumerated type can be used anywhere the C language permits an integer expression. the expressions that define the value of an enumerator constant always have int type. thus. subsequent declarations that use the tag but omit enumerator-list specify the previously declared enumerated type. Syntax enum-specifier: enum identifier opt { enumerator-list } enum identifier The optional identifier names the enumeration type defined by enumeratorlist. In ANSI C. the enumerator-list does not appear in this declaration. Syntax enumerator-list: enumerator .Variables of enum type can be used in indexing expressions and as operands of all arithmetic and relational operators. The tag must refer to a defined enumeration type. This identifier is often called the "tag" of the enumeration specified by the list. and that enumeration type must be in current scope. If the declaration of a tag is visible. Declarations of types derived from enumerations and typedef declarations for enumeration types can use the enumeration tag before the enumeration type is defined." The enumerator-list is described in detail below.

you could associate the value 0 with two different identifiers. the enumeration-constant is associated with the value given by constant-expression. The next enumeration-constant in the list is associated with the value of ( constant-expression + 1 ). The name of an enumeration-constant is equivalent to its value. The following rules apply to the members of an enumeration set: • • • An enumeration set can contain duplicate constant values. perhaps named null and zero. in the same set.enumerator-list . enumerator enumerator: enumeration-constant enumeration-constant = constant-expression enumeration-constant: identifier Each enumeration-constant in an enumeration-list names a value of the enumeration set. By default. Enumeration tags obey the normal scoping rules. They must be distinct from other enumeration. Examples These examples illustrate enumeration declarations: . structure. including ordinary variable names and identifiers in other enumeration lists. For example. if enumeration-constant = constantexpression appears in the enumerator-list. and union tags with the same visibility. The constantexpression must have int type and can be negative. Thus. The identifiers in the enumeration list must be distinct from other identifiers in the same scope with the same visibility. the first enumeration-constant is associated with the value 0. You can use enumeration-constant = constant-expression to override the default sequence of values. unless you explicitly associate it with another value.

Since the DAY enumeration type was previously declared.1 ). The identifier sunday is explicitly set to 0. only the enumeration tag DAY is necessary. true = 1 */ true }. . Note that the name of the enumeration constant is used to assign the value. enum BOOLEAN /* Declares an enumeration data type called BOOLEAN */ { false. 3 */ thursday. */ sunday = 0. */ tuesday. */ monday. a value from the set DAY is assigned to the variable today. /* Defines an enumeration type /* Names day and declares a /* variable named workday with /* that type /* wednesday is associated with The value 0 is associated with saturday by default. The remaining identifiers are given the values 1 through 5 by default. This cast is recommended in C but is not required. wednesday. friday } workday. /* false = 0. enum DAY today = wednesday. In this example. use a type cast: workday = ( enum DAY ) ( day_value . To explicitly assign an integer value to a variable of an enumerated data type.enum DAY */ { saturday.

The following Bicycle class is one possible implementation of a bicycle: . A class is the blueprint from which individual objects are created. you'll often find many individual objects all of the same kind. true } end_flag. /* statement */ .enum BOOLEAN end_flag. The name of the data type is omitted. Unnamed enumerator data types can also be declared. enum BOOLEAN match_flag. In object-oriented terms. } end_flag = true. no } response. but variables can be declared. match_flag. . true } end_flag. There may be thousands of other bicycles in existence. • • What is a class? In the real world. /* Two variables of type BOOLEAN */ This declaration can also be specified as enum BOOLEAN { false. match_flag. we say that your bicycle is an instance of the class of objects known as bicycles.\ or as enum BOOLEAN { false. The variable response is a variable of the type defined: enum { yes. all of the same make and model. Each bicycle was built from the same set of blueprints and therefore contains the same components. An example that uses these variables might look like this: if ( match_flag == false ) { .

and the methods (changeCadence. } void printStates() { System. The fields cadence. it's just the blueprint for bicycles that might be used in an application. int speed = 0. but the design of this class is based on the previous discussion of bicycle objects. The responsibility of creating and using new Bicycle objects belongs to some other class in your application. } void speedUp(int increment) { speed = speed + increment. int gear = 1. . } void changeGear(int newValue) { gear = newValue.println("cadence:"+cadence+" speed:"+speed+" gear:"+gear).) define its interaction with the outside world. void changeCadence(int newValue) { cadence = newValue. } } The syntax of the Java programming language will look new to you.class Bicycle { int cadence = 0.decrement. and gear represent the object's state. } void applyBrakes(int decrement) { speed = speed . That's because it's not a complete application. changeGear.out. You may have noticed that the Bicycle class does not contain a main method. speedUp etc. speed.

Here's a BicycleDemo class that creates two separate Bicycle objects and invokes their methods: class BicycleDemo { public static void main(String[] args) { // Create two different Bicycle objects Bicycle bike1 = new Bicycle(). bike2.printStates(). bike1. bike2. your television set.changeGear(2). Look around right now and you'll find many examples of real-world objects: your dog.changeGear(3). } } The output of this test prints the ending pedal cadence.speedUp(10). your desk.changeGear(2).changeCadence(50).speedUp(10). your bicycle.changeCadence(50). bike1.speedUp(10). // Invoke methods on those objects bike1. speed.printStates(). Bicycle bike2 = new Bicycle(). bike2. bike1. and gear for the two bicycles: cadence:50 speed:10 gear:2 cadence:40 speed:20 gear:3 • • What is an object? Objects are key to understanding object-oriented technology. bike2. bike2.changeCadence(40). . bike2. bike2.

Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication. An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). scan. but your desktop radio might have additional states (on. current pedal cadence.Real-world objects share two characteristics: They all have state and behavior. your desktop lamp may have only two possible states (on and off) and two possible behaviors (turn on. and tune). seek. turn off). A software object. You may also notice that some objects. ask yourself two questions: "What possible states can this object be in?" and "What possible behavior can this object perform?". Identifying the state and behavior for realworld objects is a great way to begin thinking in terms of object-oriented programming. increase volume. hungry) and behavior (barking. fetching. Dogs have state (name. As you do. Take a minute right now to observe the real-world objects that are in your immediate area. Make sure to write down your observations. Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. color. For each object that you see. breed. Bicycles also have state (current gear. Hiding internal state and requiring all . turn off. will also contain other objects. decrease volume. applying brakes). These real-world observations all translate into the world of object-oriented programming. off. current volume. in turn. current speed) and behavior (changing gear. changing pedal cadence. wagging tail). you'll notice that real-world objects vary in complexity. current station) and behavior (turn on.

Code re-use: If an object already exists (perhaps written by another software developer). By attributing state (current speed. if the bicycle only has 6 gears. you can simply remove it from your application and plug in a different object as its replacement. the details of its internal implementation remain hidden from the outside world. This is analogous to fixing . current pedal cadence. a method to change gears could reject any value that is less than 1 or greater than 6. task-specific objects. For example. for example: A bicycle modeled as a software object. the object remains in control of how the outside world is allowed to use it. This allows specialists to implement/test/debug complex. including: 1. and current gear) and providing methods for changing that state.interaction to be performed through an object's methods is known as data encapsulation — a fundamental principle of object-oriented programming. 3. Once created. Consider a bicycle. you can use that object in your program. 2. which you can then trust to run in your own code. 4. Pluggability and debugging ease: If a particular object turns out to be problematic. Information-hiding: By interacting only with an object's methods. an object can be easily passed around inside the system. Modularity: The source code for an object can be written and maintained independently of the source code for other objects. Bundling code into individual software objects provides a number of benefits.

a class variable can be assigned null. All of the attributes of a class are fixed before. • What is the difference between an object and a class? Classes and objects are separate but related concepts. you replace it. Since classes are reference type. The attributes of a class don't change. Ø An Object on the other hand has a limited lifespan. Every object belongs to a class and every class contains one or more related objects. not the entire machine. the attributes of the object may undergo significant change • • What is the difference between class and structure? Introduction: 1. during. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belong to that class right up until the time that it is destroyed. Also during that lifetime. . Ø The class to which an object belongs is also (usually) static. Ø A Class is static. AClass aField. If a bolt breaks. Classes are reference types and structs are value types. and after the execution of a program. Objects are created and eventually destroyed. since structs are value type.But we cannot assign null to a struct variable.mechanical problems in the real world. • struct { int } class { int AStruct aField.

Classes can have explicit parameterless constructors. But structs cannot have explicit parameterless constructors.} class MainClass { public static void Main() { AClass b = null. You cannot have instance Field initializers in structs. // Error [ Cannot convert null to 'AStruct' because it is a value type ]. public void MyFun( ) { // statements } } 6. } } 2. it gets created on the stack. 4. public void MyFun( ) { // statements } } struct MyStruct { int myVar = 10. When you instantiate a class. But you will not be dealing with references to an instance of a struct ( but dealing directly with them ). 5. it will be allocated on the heap. it's passed by value instead of as a reference. AStruct s = null.When you instantiate a struct. You will always be dealing with reference to an object ( instance ) of a class. 3. // syntax error. // No error. it is passed by reference. class MyClass . When passing a struct to a method. When passing a class to a method. // no syntax error. class MyClass { int myVar =10.But classes can have initializers.

// no exception.//NullReferenceException(because aClassObj does not contain a reference to an object of type myClass). ( structs don't support inheritance polymorphism ) So we cannot have a base structure and a derived structure. internal void aStructMethod() { // statements } } class MyClass : MyStruct // Syntax error. face="verdana"size="2"> 8. MyStruct aStructObj. public MyStruct( ) // syntax error. Classes support inheritance. { // statements } 7. aStructObj. public MyClass( ) // no syntax error. aClassObj. int aClassMethod() { // statements } . { // statements } } struct MyStruct { int myVar. Classes must be instantiated using the new operator. But structs can be instantiated without using the new operator. // MyClass aClassObj=new MyClass(). (1) struct MyStruct { int aStructVar. MyClass aClassObj.{ int myVar = 10.myVar=100.myVar=100. is the correct format.But there is no inheritance for structs. { int aClassVar.

{ int myInt. public MyClass( int aInt ) { myInt = aInt. class MyClass //No error( No matter whether the Field ' MyClass. int aClassMethod() { // statements } } struct MyStruct : MyClass // Syntax error. { int myInt. It is not mandatory to initialize all Fields inside the constructor of a class. structures can implement interfaces 9. } } struct MyStruct // Error ( Field ' MyStruct.} (2) class MyClass { int aClassVar.myString ' must be fully assigned before it leaves the constructor ). string myString. 10. public MyStruct( int aInt ) { myInt = aInt. internal void aStructMethod() { // statements } } Note : Like classes. Since struct does not support inheritance. } } . string myString.myString ' is initialized or not ). access modifier of a member of a struct cannot be protected or protected internal. But all the Fields of a struct must be fully initialized inside the constructor. { int aStructVar.

} } 12. structs are useful whenever you need a type that will be used often and is mostly just a piece of data.Member="Initialized".WriteLine("Destructor of MyStruct object"). public MyStruct( ) { } ~MyStruct( ) //Error.WriteLine("Destructor of MyClass object"). var1. A class is permitted to declare a destructor. class MainClass { static void Main( ) { Console. struct MyStruct { int myInt. public MyClass( ) { } ~MyClass( ) // No Error. { Console. MyStruct var1=new MyStruct( ). • A Sample Code: using System.// stmt --> [A] . structs are simple to use. // value of var1 is assigned to var2 MyStruct var2=var1.11. { Console.WriteLine( "Struct \n" ). } } class MyClass { int myInt.But a struct is not permitted to declare a destructor. classes are used for complex and large set data.

Console.str represent same memory location in the heap.WriteLine( obj1. } set { str=value.Member).str & obj2.WriteLine( "---------------" ).str are different memory locations in the stack. MyClass obj1=new MyClass( ).Member+"\n"+obj2.Member+"\n"+obj2.// stmt --> [B] //obj1 & obj2 are 2 reference variables in the stack. } } public struct MyStruct { string str. MyClass obj2=obj1.Member ).Member ).WriteLine( var1. // reference(or simply address)of an object stored in obj1 is assigned to obj2. Console.Member+"\n"+var2.WriteLine( "---------------" ).WriteLine( obj1. } . var1.Member="Assigned".Member="Initialized".Member="Assigned".WriteLine( "\nClass\n" ). Console. public string Member { get { return str. Console.Member ). Console. obj1. obj1.They points to a single object //in the heap.//var1.WriteLine(var1.Member+"\n"+var2. Console. Console.So obj1.str & var2.

private? What are virtual functions? What is friend function? What is a scope resolution operator? What do you mean by inheritance? What is abstraction? What is a data structure? .} } public class MyClass { string str. } set { str=value. } } } • Output: Struct Initialized Initailized --------------Assigned Initailized Class Initialized Initailized --------------Assigned Assigned • • • • • • • • What is public. public string Member { get { return str. protected.

Explain.• • • • • • • • • • • • • • • • • • • • What does abstract data type means? Evaluate the following prefix expression " ++ 26 + . Write a Binary Search program What is the difference between an Abstract class and Interface? What is user defined exception? What do you know about the garbage collector? What is the difference between java and c++? In an HTML form I have a button which makes us to open another page in 15 seconds.1324" (Similar types can be asked) Convert the following infix expression to post fix notation ((a+2)*(b+4)) -1 (Similar types can be asked) How is it possible to insert different type of elements in stack? Stack can be described as a pointer. How will you do that? What is the difference between process and threads? What is update method called? Have you ever used HashTable and Directory? What are statements in Java? What is RMI? Explain about RMI Architecture? What are Servelets? What is the use of servlets? Explain RMI Architecture? .

• • • • • • • • • • • • • • How will you pass values from HTML page to the servlet? How do you load an image in a Servelet? What is purpose of applet programming? How will you communicate between two applets? What are the basic functions of an operating system? Explain briefly about. Sheduler? . processor. assembler. linker and the functions executed by them. What are the difference phases of software development? Explain briefly? Differentiate between RAM and ROM? What is DRAM? In which form does it store data? What is cache memory? What is hard disk and what is its purpose? Differentiate between Complier and Interpreter? What are the different tasks of Lexical analysis? What are the different functions of Syntax phase. loader. compiler.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.