Top 100+ Poornam Info Vision Technical Interview Questions And Answers
Question 1. Are The Following Two Statements Identical?
Char Str[6] = Kicit ;
Char *str = Kicit ;
Answer :
No, Arrays are not guidelines. An array is a unmarried, pre-allotted bite of contiguous factors (all the same kind), fixed in length and area. A pointer however, is a reference to any statistics detail (of a specific kind) positioned anywhere. A pointer should be assigned to factor to space allocated some place else, however it could be reassigned any time.
The array declaration char str [6]; requests that space for six characters be set aside, to be known through call str. In other words there's a region named str at which six characters are stored. The pointer declaration char *str ; alternatively, requests an area that holds a pointer, to be regarded through the call str. This pointer can point nearly everywhere to any char, to any contiguous array of chars, or nowhere.
Question 2. Why Does Not The Following Code Give The Desired Result?
Int X = 3000, Y = 2000 ;
Long Int Z = X * Y ;
Answer :
Here the multiplication is done between ints x and y, and the result that might overflow might be truncated before being assigned to the variable z of kind long int. However, to get the proper output, we must use an express cast to force lengthy mathematics as proven under:
long int z = ( long int ) x * y ;
Note that (lengthy int) (x * y) might now not give the desired impact.
TCS Technical Interview Questions
Question three. How Do I Write Code That Reads Data At Memory Location Specified By Segment And Offset?
Answer :
Use peekb( ) characteristic. This characteristic returns byte(s) examine from unique phase and offset locations in memory. The following application illustrates use of this characteristic. In this application from VDU memory we have study characters and its attributes of the first row.
The statistics stored in document is then further read and displayed the use of peek( ) characteristic.
#include
#include
fundamental( )
char far *scr = 0xB8000000 ;
FILE *fp ;
int offset ;
char ch ;
if ( ( fp = fopen ( scr.Dat, wb ) ) == NULL )
printf ( Unable to open file ) ;
go out( ) ;
// reads and writes to file
for ( offset = zero ; offset < 160 ; offset++ )
fprintf ( fp, %c, peekb ( scr, offset ) ) ;
fclose ( fp ) ;
if ( ( fp = fopen ( scr.Dat, rb ) ) == NULL )
printf ( Unable to open record ) ;
go out( ) ;
// reads and writes to record
for ( offset = zero ; offset < 160 ; offset++ )
fscanf ( fp, %c, &ch ) ;
printf ( %c, ch ) ;
fclose ( fp ) ;
Question 4. What Will Be The Output Of The Following Code?
Void Main ()
Int I = 0 , A[3] ;
A[i] = I++;
Printf (%d,a[i]) ;
Answer :
The output for the above code might be a rubbish price. In the announcement a[i] = i++; the fee of the variable i would get assigned first to a[i] i.E. A[0] after which the cost of I might get incremented by 1. Since a[i] i.E. A[1] has now not been initialized, a[i] could have a garbage fee.
Question 5. Is The Following Code Fragment Correct?
Const Int X = 10 ;
Int Arr[x] ;
Answer :
No, Here, the variable x is first declared as an int so memory is reserved for it. Then it's far certified through a const qualifier. Hence, const certified item isn't a constant completely. It is an object with examine only attributes, and in C, an object related to reminiscence can not be used in array dimensions.
Wipro Technical Interview Questions
Question 6. How Do I Know How Many Elements An Array Can Hold?
Answer :
The amount of reminiscence an array can consume depends at the statistics type of an array. In DOS environment, the amount of reminiscence an array can consume depends at the cutting-edge reminiscence version (i.E. Tiny, Small, Large, Huge, and many others.). In preferred an array can not devour more than 64 kb. Consider following program, which indicates the maximum wide variety of factors an array of kind int, flow and char could have in case of Small memory version.
Major( )
int i[32767] ;
go with the flow f[16383] ;
char s[65535] ;
Question 7. How Do I Change The Type Of Cursor And Hide A Cursor?
Answer :
We can exchange the cursor type through using function _setcursortype ( ). This feature can trade the cursor kind to strong cursor and might even conceal a cursor. Following code indicates a way to trade the cursor kind and conceal cursor.
#include
essential( )
/* Hide cursor */
_setcursortype ( _NOCURSOR ) ;
/* Change cursor to a strong cursor */
_setcursortype ( _SOLIDCURSOR ) ;
/* Change lower back to the regular cursor */
_setcursortype ( _NORMALCURSOR ) ;
Infosys Technical Interview Questions
Question eight. Why Does Not The Following Statement Work?
Char Str[ ] = Hello ;
Strcat ( Str, ! ) ;
Answer :
The string function strcat( ) concatenates strings and now not a character. The primary difference between a string and a individual is that a string is a set of characters, represented by an array of characters whereas a individual is a single individual. To make the above declaration paintings writes the announcement as shown beneath:
strcat ( str, ! ) ;
Question nine. The Spawnl ( ) Function...
Answer :
DOS is a unmarried tasking running device, as a consequence only one application runs at a time. The Spawnl ( ) function affords us with the functionality of starting the execution of 1 application from within some other program. The first program is called the figure procedure and the second application that receives referred to as from within the first program is referred to as a infant technique. Once the second one software begins execution, the primary is placed on keep until the second one program completes execution. The first software is then restarted. The following application demonstrates use of spawnl ( ) feature.
/* Mult.C */
int major ( int argc, char* argv[ ] )
argc > 3 )
printf ( Too many or Too few arguments... ) ;
exit ( zero ) ;
for ( i = 1 ; i < argc ; i++ )
a[i] = atoi ( argv[i] ) ;
ret = a[1] * a[2] ;
return ret ;
/* Spawn.C */
#consist of
#encompass
main( )
int val ;
val = spawnl ( P_WAIT, C:Mult.Exe, three, 10,
20, NULL ) ;
printf ( Returned fee is: %d, val ) ;
Here, there are two programs. The application Mult.Exe works as a child system while Spawn.Exe works as a determine manner. On execution of Spawn.Exe it invokes Mult.Exe and passes the command-line arguments to it. Mult.Exe in switch on execution calculates the manufactured from 10 and 20 and returns the price to Val in Spawn.Exe.
In our name to spawnl( ) characteristic, we have passed 6 parameters, P_WAIT as the mode of execution, route of .Exe document to run as toddler process, total number of arguments to be surpassed to the child system, list of command line arguments and NULL. P_WAIT will motive our utility to freeze execution until the kid procedure has completed its execution.
This parameter needs to be exceeded as the default parameter in case you are working under DOS. Under different running structures that support multitasking, this parameter may be P_NOWAIT or P_OVERLAY. P_NOWAIT will purpose the parent technique to execute together with the child system; P_OVERLAY will load the kid method on top of the parent procedure inside the reminiscence.
Aricent Technologies Technical Interview Questions
Question 10. How Do I Compare Character Data Stored At Two Different Memory Locations?
Answer :
Sometimes in a application we require to compare memory stages containing strings. In the sort of state of affairs we are able to use capabilities like memcmp ( ) or memicmp ( ). The fundamental distinction between two features is that memcmp ( ) does a case-sensitive evaluation whereas memicmp ( ) ignores case of characters. Following application illustrates the usage of both the capabilities.
#encompass
essential( )
char *arr1 = Kicit ;
char *arr2 = kicitNagpur ;
int c ;
c = memcmp ( arr1, arr2, sizeof ( arr1 ) ) ;
if ( c == 0 )
printf ( Strings arr1 and arr2 compared using memcmp are identical ) ;
else
printf ( Strings arr1 and arr2 as compared using memcmp are not identical
) ;
c = memicmp ( arr1, arr2, sizeof ( arr1 ) ) ;
if ( c == zero )
printf ( Strings arr1 and arr2 as compared the use of memicmp are equal )
;
else
printf ( Strings arr1 and arr2 in comparison using memicmp are not
same ) ;

