Tuesday, 10 March 2015

C Interview Question

1. What does static variable mean?
Ans: Static variables are the variables which retain their values between the function calls. They are initialized only once their scope is within the function in which they are defined.

2. What is a pointer?
Ans: Pointers are variables which stores the address of another variable. That variable may be a scalar (including another pointer), or an aggregate (array or structure). The pointed-to object may be part of a larger object, such as a field of a structure or an element in an array.
3. What are the uses of a pointer?
Ans: Pointer is used in the following cases
i) It is used to access array elements
ii) It is used for dynamic memory allocation.
iii) It is used in Call by reference
iv) It is used in data structures like trees, graph, linked list etc.
4. What is a structure?
Ans: Structure constitutes a super data type which represents several different data types in a single unit. A structure can be initialized if it is static or global.
5. What is a union?
Ans: Union is a collection of heterogeneous data type but it uses efficient memory utilization technique by allocating enough memory to hold the largest member. Here a single area of memory contains values of different types at different time. A union can never be initialized.
6. What are the differences between structures and union?
Ans: A structure variable contains each of the named members, and its size is large enough to hold all the members. Structure elements are of same size.
A union contains one of the named members at a given time and is large enough to hold the largest member. Union element can be of different sizes.
7. What are the differences between structures and arrays?
Ans: Structure is a collection of heterogeneous data type but array is a collection of homogeneous data types.
Array 
1-It is a collection of data items of same data type.
2-It has declaration only
3-.There is no keyword.
4- array name represent the address of the starting element.
Structure
1-It is a collection of data items of different data type.
2- It has declaration and definition
3- keyword struct is used
4-Structure name is known as tag it is the short hand notation of the declaration.
8. In header files whether functions are declared or defined?
Ans: Functions are declared within header file. That is function prototypes exist in a header file,not function bodies. They are defined in library (lib).
9. What are the differences between malloc () and calloc ()?
Ans: Malloc Calloc 1-Malloc takes one argument Malloc(a);where a number of bytes 2-memory allocated contains garbage values
1-Calloc takes two arguments Calloc(b,c) where b no of object and c size of object
2-It initializes the contains of block of memory to zerosMalloc takes one argument, memory allocated contains garbage values.
It allocates contiguous memory locations. Calloc takes two arguments, memory allocated contains all zeros, and the memory allocated is not contiguous.
10. What are macros? What are its advantages and disadvantages?
Ans: Macros are abbreviations for lengthy and frequently used statements. When a macro is called the entire code is substituted by a single line though the macro definition is of several lines.
The advantage of macro is that it reduces the time taken for control transfer as in case of
function.
The disadvantage of it is here the entire code is substituted so the program becomes
lengthy if a macro is called several times.

11. Difference between pass by reference and pass by value?
Ans: Pass by reference passes a pointer to the value. This allows the callee to modify the variable directly.Pass by value gives a copy of the value to the callee. This allows the callee to modify the value without modifying the variable. (In other words, the callee simply cannot modify the variable, since it lacks a reference to it.)

12. What is static identifier?
Ans: A file-scope variable that is declared static is visible only to functions within that file. A
function-scope or block-scope variable that is declared as static is visible only within that scope. Furthermore, static variables only have a single instance. In the case of function- or block-scope variables, this means that the variable is not “automatic” and thus retains its value across function invocations.
13. Where is the auto variables stored?
Ans: Auto variables can be stored anywhere, so long as recursion works. Practically, they’re stored on
the stack. It is not necessary that always a stack exist. You could theoretically allocate function invocation records from the heap.
14. Where does global, static, and local, register variables, free memory and C Program instructions get stored?
Ans: Global: Wherever the linker puts them. Typically the “BSS segment” on many platforms.
Static: Again, wherever the linker puts them. Often, they’re intermixed with the globals. The only difference between globals and statics is whether the linker will resolve the symbols across compilation units.Local: Typically on the stack, unless the variable gets register allocated and never spills.Register: Nowadays, these are equivalent to “Local” variables. They live on the stack unless they get register-allocated.
15. Difference between arrays and linked list?
Ans: An array is a repeated pattern of variables in contiguous storage. A linked list is a set of
structures scattered through memory, held together by pointers in each element that point to the next element. With an array, we can (on most architectures) move from one element to the next by adding a fixed constant to the integer value of the pointer. With a linked list, there is a “next” pointer in each structure which says what element comes next.
16. What are enumerations?
Ans: They are a list of named integer-valued constants. Example:enum color { black , orange=4,
yellow, green, blue, violet };This declaration defines the symbols “black”, “orange”, “yellow”, etc. to have the values “1,” “4,” “5,” … etc. The difference between an enumeration and a macro is that the enum actually declares a type, and therefore can be type checked.
17. Describe about storage allocation and scope of global, extern, static, local and register variables?
Ans:
Globals have application-scope. They’re available in any compilation unit that includes an
appropriate declaration (usually brought from a header file). They’re stored wherever the linker puts them, usually a place called the “BSS segment.”
Extern? This is essentially “global.”
Static: Stored the same place as globals, typically, but only available to the compilation unit that contains them. If they are block-scope global, only available within that block and its subblocks.
Local: Stored on the stack, typically. Only available in that block and its subblocks.
(Although pointers to locals can be passed to functions invoked from within a scope where that local is valid.)
Register: See tirade above on “local” vs. “register.” The only difference is that
the C compiler will not let you take the address of something you’ve declared as “register.”
18. What are register variables? What are the advantages of using register variables?
Ans: If a variable is declared with a register storage class,it is known as register variable.The
register variable is stored in the cpu register instead of main memory.Frequently used variables
are declared as register variable as it’s access time is faster.
19. What is the use of typedef?
Ans: The typedef help in easier modification when the programs are ported to another machine.
A descriptive new name given to the existing data type may be easier to understand the code.
20. Can we specify variable field width in a scanf() format string? If possible how?
Ans: All field widths are variable with scanf(). You can specify a maximum field width for a given
field by placing an integer value between the ‘%’ and the field type specifier. (e.g. %64s). Such a specifier will still accept a narrower field width.
The one exception is %#c (where # is an integer). This reads EXACTLY # characters, and it is the
only way to specify a fixed field width with scanf()

21. Out of fgets() and gets() which function is safe to use and why?
Ans: fgets() is safer than gets(), because we can specify a maximum input length. Neither one is completely safe, because the compiler can’t prove that programmer won’t overflow the buffer he pass to fgets ().

22. Difference between strdup and strcpy?
Ans: Both copy a string. strcpy wants a buffer to copy into. strdup allocates a buffer using malloc().
Unlike strcpy(), strdup() is not specified by ANSI .
23. What is recursion?
Ans: A recursion function is one which calls itself either directly or indirectly it must halt at a definite point to avoid infinite recursion.
24. Differentiate between for loop and a while loop? What are it uses?
Ans: For executing a set of statements fixed number of times we use for loop while when the number of
iterations to be performed is not known in advance we use while loop.
25. What is storage class? What are the different storage classes in C?
Ans: Storage class is an attribute that changes the behavior of a variable. It controls the lifetime, scope and linkage. The storage classes in c are auto, register, and extern, static, typedef.
26. What the advantages of using Unions?
Ans: When the C compiler is allocating memory for unions it will always reserve enough room for the
largest member.
27. What is the difference between Strings and Arrays?
Ans: String is a sequence of characters ending with NULL .it can be treated as a one dimensional array
of characters terminated by a NULL character.
28. What is a far pointer? Where we use it?
Ans: In large data model (compact, large, huge) the address B0008000 is acceptable because in these
model all pointers to data are 32bits long. If we use small data model(tiny, small, medium) the above address won’t work since in these model each pointer is 16bits long. If we are working in a small data model and want to access the address B0008000 then we use far pointer. Far pointer is always treated as a 32bit pointer and contains a segment address and offset address both of 16bits each. Thus the address is represented using segment : offset format B000h:8000h. For any
given memory address there are many possible far address segment : offset pair. The segment register contains the address where the segment begins and offset register contains the offset of data/code from where segment begins.
29. What is a huge pointer?
Ans: Huge pointer is 32bit long containing segment address and offset address. Huge pointers are
normalized pointers so for any given memory address there is only one possible huge address segment: offset pair. Huge pointer arithmetic is doe with calls to special subroutines so its arithmetic slower than any other pointers.
30. What is a normalized pointer, how do we normalize a pointer?
Ans: It is a 32bit pointer, which has as much of its value in the segment register as possible. Since
a segment can start every 16bytes so the offset will have a value from 0 to F. for normalization convert the address into 20bit address then use the 16bit for segment address and 4bit for the offset address. Given a pointer 500D: 9407,we convert it to a 20bitabsolute address 549D7,Which then normalized to 549D:0007

31. What is near pointer?
Ans: A near pointer is 16 bits long. It uses the current content of the CS (code segment) register (if
the pointer is pointing to code) or current contents of DS (data segment) register (if the pointer is pointing to data) for the segment part, the offset part is stored in a 16 bit near pointer. Using near pointer limits the data/code to 64kb segment.

32. In C, why is the void pointer useful? When would you use it?
Ans: The void pointer is useful because it is a generic pointer that any pointer can be cast into and
back again without loss of information.
33. What is a NULL Pointer? Whether it is same as an uninitialized pointer?
Ans: Null pointer is a pointer which points to nothing but uninitialized pointer may point to anywhere.
34. Are pointers integer?
Ans: No, pointers are not integers. A pointer is an address. It is a positive number.
35. What does the error ‘Null Pointer Assignment’ means and what causes this error?
Ans: As null pointer points to nothing so accessing a uninitialized pointer or invalid location may cause an error.
36. What is generic pointer in C?
Ans: In C void* acts as a generic pointer. When other pointer types are assigned to generic pointer,
conversions are applied automatically (implicit conversion).
37. Are the expressions arr and &arr same for an array of integers?
Ans: Yes for array of integers they are same.
38. IMP>How pointer variables are initialized?
Ans: Pointer variables are initialized by one of the following ways.
I. Static memory allocation
II. Dynamic memory allocation
39. What is static memory allocation?
Ans: Compiler allocates memory space for a declared variable. By using the address of operator, the
reserved address is obtained and this address is assigned to a pointer variable. This way of assigning pointer value to a pointer variable at compilation time is known as static memory allocation.
40. What is dynamic memory allocation?
Ans: A dynamic memory allocation uses functions such as malloc() or calloc() to get memory dynamically. If these functions are used to get memory dynamically and the values returned by these function are assigned to pointer variables, such a way of allocating memory at run time is known as dynamic memory allocation.

41. What is the purpose of realloc?
Ans: It increases or decreases the size of dynamically allocated array. The function realloc (ptr,n) uses two arguments. The first argument ptr is a pointer to a block of memory for which the size is to be altered. The second argument specifies the new size. The size may be increased or decreased. If sufficient space is not available to the old region the function may create a new region.

42. What is pointer to a pointer?
Ans: If a pointer variable points another pointer value. Such a situation is known as a pointer to a pointer.
Example:
int *p1,**p2,v=10;
P1=&v; p2=&p1;
Here p2 is a pointer to a pointer.
43. What is an array of pointers?
Ans: if the elements of an array are addresses, such an array is called an array of pointers.
44. Difference between linker and linkage?
Ans: Linker converts an object code into an executable code by linking together the necessary built in
functions. The form and place of declaration where the variable is declared in a program determine the linkage of variable.
45. Is it possible to have negative index in an array?
Ans: Yes it is possible to index with negative value provided there are data stored in this location. Even if it is illegal to refer to the elements that are out of array bounds, the compiler will not produce error because C has no check on the bounds of an array.
46. Why is it necessary to give the size of an array in an array declaration?
Ans: When an array is declared, the compiler allocates a base address and reserves enough space in
memory for all the elements of the array. The size is required to allocate the required space and hence size must be mentioned.
47. What modular programming?
Ans: If a program is large, it is subdivided into a number of smaller programs that are called modules or subprograms. If a complex problem is solved using more modules, this approach is known as modular programming.
48. What is a function?
Ans: A large program is subdivided into a number of smaller programs or subprograms. Each subprogram
specifies one or more actions to be performed for the larger program. Such sub programs are called functions.
49. What is an argument?
Ans: An argument is an entity used to pass data from the calling to a called function.
50. What are built in functions?
Ans: The functions that are predefined and supplied along with the compiler are known as built-in functions. They are also known as library functions.


Saturday, 31 January 2015

Software Engineering

                Software Engineering

 

A Layered Technology


Divided into 4 layers:-

1. A quality Process :-     
  •   Any engineering approach must rest on an quality.
  • The "Bed Rock" that supports software Engineering is Quality Focus.
2. Process :-
  • Foundation for SE is the Process Layer
  • SE process is the GLUE that holds all the technology layers together and enables the timely development of computer software.
  • It forms the base for management control of software project.
3. Methods :-
  • SE methods provide the "Technical Questions" for building Software.
  • Methods contain a broad array of tasks that include communication requirement analysis, design modeling, program construction testing and support.
4. Tools :-
  • SE tools provide automated or semi-automated support for the "Process" and the "Methods".
  • Tools are integrated so that information created by one tool can be used by another.

Thursday, 13 November 2014

Bypass school proxies using cocoon

There is a way to bypass school proxies using cocoon

toolbar.

Cocoon:

Cocoon is an add-on plugin which is used to bypass any blocked websites. Before using cocoon you need to be registered in cocoon official site. If u register it can be used  as unlimited version. It is an free usage so there is no premium account needed. save your by using coccon instead of taking rent of other proxies .
Currently cocoon plugin is available for Firefox, Chrome (only mac), Cocoon Chrome for windows is coming soon. So windows chrome user you need to wait for this add-on to be launched for chrome. But instead you can use it in Firefox in windows operating sytem. Not only in windows. It can be installed with any Firefox browser from Ubuntu and fedora..

SEE ALSO: BREAK SCHOOL PROXY EASILY

cocoon plugin to Firefox add-on for simple proxy to bypass the site

How to use COCOON?

#Step 1: You need to be registered with cocoon official site >> cocoon site .
#Step 2: For windows user, you need Mozilla Firefox browser to install this plugin. If  you don’t have Firefox visit this link to download  Firefox.
#Step 3:  After downloading Firefox install cocoon add-on plugin in Firefox. To get install cocoon add-on click this link. If this link fails to download in school or college computer. Try this alternate link to install
#Step 4: After installing cocoon add-on on Firefox,  one blue Toolbar will be seen under address bar like this
New toolbar in all it's glory! - cocoon toolbar in placed in your webbrowser
#Step 5: Press the power button on left corner on cocoon Toolbar to enter username and password and click Go button to get it access. See the image below
cocoon toolbar in placed in your webbrowser - cocoon login button
#Step 6: After that it will enter into your cocoon account homepage like this
cocoon toolbar in placed in your webbrowser - cocoon login button  in - browser opens with cocoon  account to break proxy in it
#Step 7: Now your browser will break any blocked website and bypass it.
If you have any problems regarding installing cocoon. know us through comments !!! .

Friday, 7 November 2014

By Pass Proxy For Pondicherry University 

Saturday, 25 October 2014

14 Ways to access blocked websites in schools/collages /offices

In many collages schools and offices, the management use to block many social networking and useful websites due to various reasons. Even our favorite sites like FACEBOOK, TWITTER, G MAIL, MYSPACE, HI5, and FREINDSTER are getting blocked these days. This article will let you know about the all possible ways to unblock websites on internet so that you can access the blocked websites easily. By using the below mentioned tricks you can unblock and open almost any websites on internet.

Here you go, A COMPLETE GUIDE TO UNBLOCK WEBSITES ON INTERNET

14 ways to access blocked websites



1. Proxy websites to access blocked websites

Proxy websites are nothing but of online proxy servers, Instead of directly connecting to the websites that are blocked at your place, you will first connect to a Proxy server and it will redirect to the blocked website and you can access them easily.
There are many proxy websites available on internet, I can give you a huge list of them. But these are most widely used online proxies.

  1. http://www.hidemyass.com
  2. http://www.spysurfing.com
  3. http://kproxy.com/index.jsp
  4. http://proxify.com/
  5. http://www.proxymouse.com

How to open blocked websites using Hidemyass,

  First goto HIDEMYASS website.Enter the URL of the blocked website in the input Box and click on the button HIDEMYASS. Instantly it will show the blocked website.


You can use this simple method to access all the static websites and can access them quite easily, IF even HIDEMYASS website is blocked in your collage, school or office just pick any other proxy website from the above list it will work fine.

2. Use Tor Browser to surf anonymously to open blocked sites.

Using the above method you can only access the static websites, you can't use social networking sites like Facebook, twitter, MYSPACE…etc. because social networking sites uses browser to store cookies and that can’t be possible by using these Proxy websites. So, here is an alternate way 
Using TOR  you can browse anonymously on internet. Its most widely used utility for hiding our identity online. Just Download it from the below link and start using it

3. Hola browser extension to Unblock websites.


Hola is Browser extension available for all popular browsers, by using this extension you can browse on internet anonymously. Just check the official website of HOLA and install the browser extensions directly from there.

4. Use Proxy IP address in browser settings.

Few of the browsers supports to use the PROXY IP address in them. So that if you can surf anonymous using them. To use this you need Mozilla fire fox web browser and Proxy Ip address. You can get the huge list of Proxy websites from HERE.
In your Mozilla Firefox browser open the OPTIONS box and click on ADVANCED. Below the CONNECTIONS select SETTINGS. Click on MANUAL PROXY SETTINGS and enter the PROXY IP address (click HERE for PROXY IP address list), Port 8080 there and save settings. With this your browser will surf using that proxy ip address. You can pick and change the other Proxy IP address if that’s not working.

5. Access Blocked websites by Using Way Back Machine.

WayBackMachine is a through which we can know about the previous Look of any website from its archives. Enter the URL of the blocked website and you can even access the previous versions of the website that are blocked at your Place.

6. Use IP address instead of domain name

Collages/schools and websites normally block websites using some software’s in which they enter URL’s of the Websites they need to block, so that whenever if you enter the domain name of any website they will simply get blocked. So you can access those websites if you enter the IP address of the websites
To find the IP address of the website just open  your command prompt on your Windows PC by pressing WIN+R > type CMD > hit ENTER. Now in the Command prompt just enter the following code.
Ping website.com (enter the blocked website in the place of website.com).
Now enter that IP address on your browser and you can access the BLOCKED websites.

7. Open Blocked sites using decimal code.

In the above method I asked you to use the IP address, but what if even the IP address of the website that you need open was also blocked?? 
By using the decimal numbers you can access any blocked websites, because none will even block the IP address in decimal. To get the decimal code of IP address using THIS TOOL 
For example IP address of google is http://74.125.236.160/ you can use the decimal format instead HTTP://1249766560

8.  Take help of Google cache


Google store the cache of each and every website often. You can access the cache of any website using googles old CACHE. Just search for the BLOCKED website which you need to open and click on the CHACHE link below the search results as shown in the below screen shoot.

9. Using Translation web services

There are many website on the internet GOOGLE - TRANSLATE and BING - TRANSLATE like which will convert the whole page from one language to another. Enter the URL of the blocked website in those site and convert the web page into another language. From this you can convert the whole page into another language and can access it.

10. Browsing on HTTPS connection


HTTPS is nothing but of the secure connection, where data will be encrypted. This trick will work in many colleges and schools (This trick even worked in my Collage). Instead of using HTTP use HTTPS and try to access the website. For example you need to visithttp://www.google.com then try https://www.google.com and try to access the site.

11. Open blocked websites Using URL shortners

Normally URL shornters are used to shorten the length of the lengthy websites. By using such sites you can bypass the security and access the websites. Try using TINY URL MooURL

12. Get an email of the webpage using web2mail


Web2mail is a free site which will let you to get the mail of any webpage that you requested. Check the site for more details. You can get any blocked website as mail to you so that you can access them VIA your email.

13. Use VPN software’s and Unblock websites


VRN software’s will let you to browse anonymously, you just need to download and install them on your PC. There are both paid and free VPN software’s available. Here are 3 best VPN software’s that will allow you to unblock websites.

  1. HotspotShield VPN
  2. TunnelBear Vpn
  3. ProXPN VPN