Вы находитесь на странице: 1из 10

1. How will u create infinite loop?

while(1)
{
}
2. Difference between macro and inline functions?
macro is preprocessing directive. Debugging is difficult. we can debug inline functions. Inline functions substitute
the code at calling fun only. Inline functions are faster compared to macro. Inline occupies more memory
compared to Macro, because when ever inline function called entire code is pasted to the caller.
3. What is constant function explain with program? can constant functions can access all data members in class?
class base
{private:
int a;
public;
func () constant;
}
constant function can access all the data members .but, constant data members can be accessed by constant
member functions only
4. Write a program to copy a string that will return a pointer to the starting location?
Strcopy (char*t, char*s)
{
while(* t!='\0')
*t=*s;
s++;
t++;
}
*t='\0';
return(t[0]);
}
5. Write a program for memory allocation for 100 bytes of data?
int*a=(int*)malloc(100*size of (int);

6. WAP for memory allocation of two-dimensional array of size 10*10? ( char **ptr) ???
7. Write a program which takes integer inputs and calls the functions
accordingly?
Input - function
10

- func A

40

- func B

70

- func C
120

- func D]

main()
{
int n;
pritnf("\n enter any interger value");
scanf("%d",&n)
switch(n)
case10:funca();
break;
case40:funcb();
break;
case70:funcc();
break;
case120:funcd();
break;
}
8. Write a program for single linked list- creation, insertion, deletion and reverse
9. Derived*ptr = new base;

is this valid? Explain?

No this is not valid. Pointer is derived type and we cannot allocate memory of base type.
10. What are files? How the files concept useful in C? Have u worked with files?

In c programs will be stored in different files. And we can include on file into other file when we want to use. Using
files concept we can spilt our program instead of one big program.
11. What are enumeration constants? Are they can be modified? Have used in programming? How r they useful?
Using enumerated data types we can assign question own data types. Each value on the list of permissible values
corresponds to an integer starting with zero.
We can modify them.
These are used to clarify the program.
13. Write a program to convert decimal numbers to binary numbers in one line?
By and ing that decimal number with 01.
14. What is difference between definition and declaration?
Declaration will not store any place. Definition will allocate memory.
15. Questions on complicated declarations? Pointers and functions
Char (*(*x [3]) ( )) [5];
x is an array of 3 integer pointers of a function returning a pointer to an array of 5 characters.
16. What is ifdef and elif? do u know these? what is significance of these?
ifdef is used check whether a partcular macro is defined or not.
elif is test whether an _expression evaluates to zero or not.
these are preprocessive directives.
C LANGUAGE:
1. When doubly linked list is useful and when is singly linked list is useful?
2. When singly linked list is useful and when is array is useful?
For insertion, deletion, memory allocation during running time linked list is useful. For fast accessing arrays are
useful
3. What is difference between structure and union?
Structure allocate continues memory for all the declared variables, whereas union allocate single copy of
memory .
4. What is size of the union if it has three variables one int, one char and one double?
4 bytes( size of double)
5. What do u about static variable?
If we declared a variable as static variable then it can visible to other functions and its value persists between
different function calls.

6. If static variable declared out side the main program then how it will work?
Then it cannot be accessible to other files.
7. How the extern keyword is useful?
By declaring a variable using extern keyword then we access the global variable declared in other files
8. If I declared as Extern int x=1; will it get compiled? How? What r errors? How they occurred?
It will be syntax error as redeclaration of x
9. How will write code for 2s compliment of a binary number?
Using ~(tilt) we can get 1s compliment by adding one to that number we can get 2s compliment
10. I declared a variable as signed int? how will u check whether it is signed or unsigned?
By checking it boundaries. Means signed integer can have highest value upto32767 for 16 bit machine.
11. If the size of the integer is 2 bytes. What is the maximum size that signed variable can have?
32767
12. How can u access a variable which is in another file?
Using extern keyword
13. How will u include a header file in your code?
Using #include
14. If I declared a variable in header1.h file and it included in header2.h and header 3.h. And all these three are
included in file1.c then how it will get executed?
No it will not execute. We get syntax error as redeclaration of the variable. We can overcome this using IFDEF.
15. What r different stages that a file go in compilation?
Compiler, linker, loader
C questions:

what r different storage classes in C?


Automatic, register, static and global

What

is difference between static and global?

Global variable can be accessed from other functions. Static variables cannot be accessed. Both store the
values in the memory till the end of the program.

What happens if we declared a global variable as static variable?


It is invisible other files

what is difference between the variables declared as static and global outside main function?

Global variables can accessed in other files. But static cannot.

What happens to function if we declared it as a static function?


These cannot accessed in other files

If we declared two variables inside a function one as static and other as global? What is the difference between
these two?
Both will act like same

What does compiler exactly do if we declared a variable as static?


Compiler will allocate memory to that variable and every change to that variable will be stored till the exit of the
program

What is register storage class?


It will store variables in registers. If we want access a variable recursively then we declare it as register variable.
Cos accessing a register variable is fast,.

What happens if we declared a register variable to store 100 bytes of data? Will it save? If not what happens to
the variables?
But the no. of registers is very less so the compiler will decide whether to store in registers or not depending
upon the requirement of registers,. If reg are not free it will store them as automatic variables.

What is difference between structure and array?


Structure stores different data types, array can store single data type

How does a union save two integers? How memory allocated to these two variables?
Union will allocate memory for largest data type.

What is the difference between pointers and arrays?


Pointer is a variable which stores the address of a variable. Arrays store single data type.

If I declared two variables one is an array of 10 integers and other is integer pointer which has allocated a
memory of 10 integers. Then what is the difference of these two?
Both are same. Using pointers is safe.

What is virtual memory?


virtual memory allows software to run in a memory address space whose size and addressing are not necessarily
tied to the computer's physical memory.

How do u find whether the given number is integer or not without using modulus operator?

What

is size of a pointer? What is size of integer pointer in 16 bit machine and 32 bit machine? What is size of
character pointer for 16 and 32bit machine?
Size of integer 2 and char is 1 in 16 bit machine. In 32 bit machine int is 4 and char is 2

Microcontroller:

what is difference between microprocessor and microcontroller?


Microcontroller contains internal memory, i/o peripherals, interrupts, UART for serial communication.

What does the presence of memory do incase of microprocessor?


Even though microprocessor has memory as microcontroller it will not act like microcontroller

How many input ports are there in a micro cont roller? How many output ports are there?
Microcontroller has 40 pins all can be used as input and output ports

How many interrupts are there?


5 interrupts

What is internal RAM and ROM size of a microcontroller?


RAM 128 bytes, 4KB of ROM

What happens if a serial interrupt occur at serial port pin?


then the execution of the main program will be delayed and it will jump to the address where the code has been
written

How does it know the address location if an interrupt occurs?


Using virtual table. For serial communication its address is 2300h

Is there any table inside memory of controller?


Yes virtual table will present

What is virtual address location of a serial communication port?


2300h

Have u ever developed the virtual table?

What is main memory in microprocessor?


CPU

How can 256MB RAM can perform a program of size 4GB?


With the help of virtual memory

What does u know about virtual memory?


virtual memory allows software to run in a memory address space whose size and addressing are not necessarily
tied to the computer's physical memory.

How it will work?


If there is no sufficient space in main memory then code will swapped to virtual memory and it will execute there

Do u knows about memory management?


Yes. Memory management is technique used for is the act of managing computer memory. In its simpler
forms, this involves providing ways to allocate portions of memory to programs at their request, and freeing it for
reuse when no longer needed.
Virtual memory systems increase the effectively available amount of RAM using disk swapping. The quality of the
virtual memory manager can have a big impact on overall system performance.

Questions asked:
1)
2)
3)
4)
5)
6)
7)

8)
9)

Explain about yourself and your projects.


What is your ranking (from 1 to10) in C++ and UNIX?
Were the projects done in UNIX platform or Windows?
What are the tools used in UNIX.
What are the storage classes in C++?
Automatic, register, static and global.
Difference between global variables and auto.
Global variable can be accessed by any function. Auto variables are local to that function only.
Scope and life time of static, auto and global variables.
Changes in Static variables persists between different function calls. Auto variable changes its
value for every function call. Static variable remain in memory till the exit of the program. Where
as auto variables life time is for one function call only.
Copy constructor and its syntax.
Copy constructor used to copy one object into another object.
Copy (const copy& copy);
How can you write a copy constructor for a class, class a?
Class x
{
Private:
int a;
Public:
x(const x&x);

10) Difference between C & C++.


C language is structure oriented language and C++ is object oriented language.
11) Various phases involved in projects.
12) Designing tools involved in project. (I focused on UML).
13) How is implementation done?
14) How is software tested?
15) Explain about Use case diagram and Class diagram.
16) Given a class with a method in it, draw Class diagram for it.
17) Concepts of Object Oriented Programming.
Data encapsulation, inheritance, polymorphism
18) Difference between:
(a) int (*f) (char k);- pointer to a function taking a character variable as an argument and
returning int

(b) int *f (char k);- function taking a character variable as an argument and returning a
integer pointer
19) Dynamic memory management in C++
20) How can you delete the memory allocated for
Char *p = new char [100];
Delete p;
21) Draw the use case diagram for your project done.
22) Write a class with two members in it.
23) Are you perfect in Oracle
24) How long did u work on UNIX.
25) For the code below--Void f(int a)
{
Int b=a;
Cout <<b << end;
}
If f is function, what is the lifetime of the variable b
Upto this function only.
----------------------------------------------------------------------------------------------------------------------C++, UNIX, wipro 2+yrs
1) Tell me about Ur self?
2) Tell me about the ospf project?
3) Is it a connection oriented or connection less?
Connection oriented
4) What are client and server side system calls for connection oriented?
Client
server
Socket()
socket()
Bind()
Listen()
Connect()
accept()
Write()
read()
Read()
write()
Close()
close()
5) What are client and server side system calls for connection less?
Client
server
Socket ()
socket ()
Bind ()
bind ()
Send to ()
recvfrom ()
Recvfrom () sendto ()
Close ()
close ()
6) What are the arguments for listen system call?
Listen (socket id, no. of clients)
7) What does bind system call do?
The bind system call associates a name with the socket descriptor. Server processes bind
addresses to socket and advertise their names to identify themselves to client processes.
8) What is the return type of socket system call?
Socket descriptor
9) What is router?
Router is used to connect two or more no .of networks

10) What are different layers in TCP/IP and OSI model?


TCP/IP: Physical layer, data link layer, network layer, transport layer, application layer
OSI model: Physical layer, data link layer, network layer, transport layer, session layer,
presentation layer, application layer
11) How does session layer works?
These will get data from presentation layer and send to transport layer and visecersa.
12) How does session layer works between two systems?
Session layer is responsible to dialog control and synchronization.
13) How TCP/IP send data in streams or datagram type?
In streams.
14) What does physical layer do?
Physical layer is responsible for movement of individual bits from one hop to the next
Hop.
15) Write a simple structure?
Class x
{
Private:
Int a;
Public:
Void func ();
};
16) Syntax of copy constructor?
x(const x&x);
17) What is constructor?
The constructor is a special member function that allows to setup values while defining the
object, with out the need to make separate call to a member function. Thus, constructor is a
member function that is executed automatically whenever an object is created.
18) What is destructor?
When an object is destroyed a function called destructor automatically gets called.
19) Which is version of UNIX used?
20) How did u compile Ur projects?
21) How will u link and compile files in UNIX using cc command?
22) What are storage classes?
Automatic, static, register and global
23) What is static mean?
24) Tell about register storage class?
25) What is polymorphism?
Polymorphism is the capability of object having same interface but providing different
implementation.
hat is the output of the following ?
#include <stdio.h>
int
main ( void )
{
char a[] = "abc";
char b[] = "xyz";
*a = *b++;
puts ( a );
return 0;

}
Ans The only operations that can be performed directly on an array value are the application of
the sizeof and address (&) operators. For sizeof, the array must be bounded and the result is the
number of storage units occupied by the array. The result of & is a pointer to (the first element of)
the array. And, in the above program we are trying to increment array type, b, which is not allowed.
It is an error.

Вам также может понравиться