Campus Papers


&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

Check this websites for Jobs

http://www.fresherjobs.in/education/be-btech-me-mtech

http://www.fresherjobs.in/core-technical-jobs

 

&&&&&&&&&&&&&&&&^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

WIPRO DS

What is the basic difference between Stacks and Queues in data structures?

Answer :

A stack is a data structure where the last element inserted is processed first i.e if an element E4 is inserted after E3 into a stack, the first element to be retrieved will be E4 followed by E3. In Queue processing order is exactly opposite to that of Stack. The first element inserted will the be the first one to be processed/served.

Question 2

Can you expand LIFO and FIFO used in context of Stacks and Queues respectively? Explain why Stack is called LIFO and Queue is called FIFO.

Answer :

LIFO stands for Last In First Out and FIFO stands for First In First Out. (The next part of explanation is very similar to the answer of previous question) Stack is called LIFO because Last element inserted is served first and Queue is called FIFO because First element is served first.

Question 3

You would have come across programs using recursive function calls in programming languages like C. For example, one can write a recursive program to find the factorial of a number. In such scenarios which of the data structures from among Stacks and Queues are employed to store temporary variables?

Answer :

In case of recursive functions, the Stacks are involved to store temporary variables.

Question 4

Can you mention any one practical application of Queues by Operating Systems in scheduling tasks?

Answer :

While sending tasks to the printer queue, an operating system usually employs Queues. First item sent to printer is printed first followed by next item and so on

&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

HCL QUESTIONS 15/11/2012

Very often you can expect basic C programs using recursive algorithms in interviews of leading companies like HCL. Below are few for your practice.

Question 1

In C programs, if a function calls itself within its definition, what can you say about that function?

Answer :

Such functions are called Recursive functions.

Question 2

Does recursion algorithm help in significantly reducing system resources (e.g.. memory) required compared to normal programs?

Answer :

Not necessarily. Though the lines of code and programmer’s effort are greatly reduced, the system resources may not be spared compared to normal programs. In fact, recursive programs may be more expensive in terms of memory usage. For example, if the function repeats itself n number of times due to recursion, temporary variables will be pushed on to stack about n number of times (and subsequently retrieved in reverse order).

Question 3

Can you tell any two example problems where recursive functions come handy?

Answer :

Programs to print out series like FIBONACCI can be easily implemented by recursive logic. Similarly, programs to calculate FACTORIAL of numbers can be implemented.

Question 4

Can you write a C program to print out FIBONACCI series using recursive logic?

Answer :

We are leaving this question for you to practice.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Updated on 11/11/2012

C programming language has several reserved keywords with varied use/applications. Below are few questions based on C Keywords.

Question 1

In regards to variable declarations within functions, explain ‘auto’ keyword.

Answer :

Variables used in C programs are qualified by ‘storage classes’. They define the visibility and life time of the variables. ‘Auto’ is the default storage class of variables. The variables of storage class ‘auto’ can be used only within the declared function.

Question 2

Can you explain the usage of ‘void’ keyword?

Answer :

C functions can optionally return value and work with one or more than one passed parameters. void is used in the following scenarios.

a. A function does not return a value.
b. A function does not require parameters.
c. A function does not return a value as well as does not require parameters.

Question 3

Can you explain the usage of ‘register’ keyword?

Answer :

‘Register’ refers to a storage class which recommends that the corresponding variable/variables need to be stored in CPU registers. (CPU registers are fast memory access locations.)

Question 4

With regard to program control flow, explain ‘goto’ keyword?

Answer :

‘goto’ keyword is used to force program control to move to a labeled location.

%%%%%%%%%%%%$$$$$$$$$$$$$$$%%%%%%%%%%%%%%%%%%%

Updated on 8/11/2012

Below are three problems dealing with probability and time calculations.

Question 1

From a railway junction RJ, trains leave from platforms P and Q for every 20 minutes and 30 minutes respectively. Assume all the trains travel with constant speed. The service from platform P starts at 6.00am and the service from platform Q at 6.05 am. Assume that you are waiting in a nearby station. Any train from RJ would require 5 minutes to reach your station. Now, what is the probability that you will be able to board a train from P in between 6 and 6.30 am.

a)2/3 b)1/3 c)1 d)1/4

Answer : a)2/3

Solution :

From Platform P

The first train will leave by 6 am and reach your station in 5 minutes, i.e. at 6.05 am
Second train will leave after 20 minutes i.e at 6 am and reach your station at 6.25 am

From Platform Q

The first train will leave by 6.05 am and reach your station at 6.10 am.
Second train will leave after 30 minutes i.e at 6.35 am and reach your station at 6.40 am.

Inference.

Between 6 and 6.30 am, first and second trains from P and first train from Q will reach your station. In other words, you will be able to board 2 trains from P and 1 train from Q.

Therefore, probability that you will board a train from P = Trains from P between 6 and 6.30 / Total Trains from P and Q between 6 and 6.30 = 2/3

Question 2

From a bus stand, buses leave for every 15 minutes to both temple and Railway junction. First bus towards junction is at 7.00 am and towards temple is at 7.10 a.m. Suppose you have to visit both temple and junction and decide to go by the first bus you encounter. Then the probability to get a bus towards temple is ___ .

a)0.67 b)0.5 c)0.75 d)0.33

Answer : a)0.67

Solution :

Let us discuss an interesting method to solve such problems :

Let’s simulate a 60 minute time period:
A period of 60 Minutes broken into intervals of 5 minutes each:
0 – 5 – 10 – 15 – 20 – 25 – 30 – 35 – 40 – 45 – 50 – 55 – 60(or “0” again)
Arrival of BUS : ( t = temple, j = junction, X = no bus arrives at that particular time)
j – X – t – j – X – t – j – X – t – j – X – t – j

TO MAKE IT EASY TO UNDERSTAND WE HAVE WRITTEN THE SAME THING AGAIN.

0 - 5 - 10 - 15 - 20 - 25 - 30 - 35 - 40 - 45 - 50 - 55 - 60
j - X - t -  j -   X -  t -  j - x -  t -  j  - x -  t - j
0       10   5          10   5        10   5         10  5

The line written immediately above (that is the 3rd line of data) has numbers corresponding to “t” and “j” which shows how many minutes a person has to wait till he gets the “First bus”.

Therefore,

t= 10 + 10 + 10 + 10 = 40 Minutes
j= 0 + 5 + 5 + 5 + 5 = 20 Minutes

Therefore in 40 minutes of standing time for the bus you will get t bus and in 20 minutes of standing time for the bus you will get j bus.
You will also see that this is the schedule for every hour after 7.00 A.M.

This means that the probability to get t bus is = 40 Minutes / 60 Minutes = 2/3 = 0.67
Also the probability to get j bus is = 20 Minutes / 60 Minutes = 1/3 = 0.33

Hence the answer is 0.67

Question 3

A man has to go to both Pune and Mumbai. He decides to go by whichever first train he encounters. The first train towards Pune is at 8:00 am and the frequency of Pune trains is 10 minutes. The first train towards Mumbai is at 8:10 am and the frequency of Mumbai trains is 15 minutes. Assume that the man arrives at railway station at a particular time between 8 and 9 am. What should be his exact arrival time at the station that will leave him really confused on whether to go Pune or Mumbai.

a)9.00am b)9.10am c)8.40am d)8.25am

Answer : c)8.40am

Solution :

The man plans to go by first train he encounters. Hence at times when only one of the trains leave, he will never get confused. But if his arrival time is greeted by both the trains (one to Pune and one to Mumbai) starting simultaneously the man will surely be confused.

First train to Pune is at 8 am and the frequency is 10 minutes.
Therefore Pune trains will leave at the following times : 8 am, 8.10am, 8.20am, 8.30am, 8.40am, 8.50am and so on.

First train to Mumbai is at 8.10 am and the frequency is 15 minutes.
Therefore Pune trains will leave at the following times : 8.10 am, 8.25am, 8.40am, 8.55am, 9.10am and so on.

At 8.40am both the trains will leave simultaneously. This is the time at which the fellow can really be confused.

%%%%%%%%%%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

Questions Updated on 29/10/2012 Refer it

Question 1Assume you have a program which uses two character variables. Now, if you wish to use the power of C string functions on data contained in those two variables what you would do?

Answer :

One way is to declare the character variables as single length string arrays. By this, you can start using string functions seamlessly.

Question 2

Why comments are necessary and what difficulty a C program will lead to without comment ? What syntax will you use for C comments ?

Answer :

Comments are necessary for a C program to make it more readable. Especially if you have a C project with hundreds of lines of code, and if there are no comments to explain the code, the maintenance of the application will become very tedious.
In C comments will be enclosed with /* and */.

Question 3

Is it possible to pass command line arguments to C programs? If yes, can you write down the prototype for main function with command line arguments?

Answer :

Yes, it is possible to pass command line arguments to C programs i.e main function is capable of receiving and processing command line arguments. The prototype for the same is

int main ( int argc, char *argv[] )

Here, argc denotes the number of command line arguments and *argv[] is the list of arguments.

Question 4

Some argue C as loosely typed (weakly typed) language. Can you tell with an example why it is called so ?

Answer :

In C char data can be used in place of integers in case of arithmetic operations. These kinds of features should not be permitted in strongly typed languages. Hence, C is called as weakly typed by some. For example, below program is valid in C

#include
#include
main()
{
clrscr();
int a = 10;
char b = 'c';
printf("\n%d", a + b);
printf("\n%d", b);
getch();
return 0;
}

The output will be
109
99

++++++++++++++++===================================

++++++++++++++++++===============================

Top 100 General Interview Questions
Q: Describe yourself.
Q: How do you take challenges?
Q: How do you define failure?
Q: What do you know about the organization?
Q: How do you justify the job?
Q: Why do you want this job?
Q: What does success mean to you?
Q: What are your strengths?
Q: What are your weaknesses?
Q: What do you do in leisure time?
Q: Do you want to ask anything from us?
Q: What are your hobbies?
Q: What kind of person are you?
Q: How do you pursue your hobbies?
Q: What has been your greatest achievement?
Q: What has been your greatest failure?
Q:How did you prepare for this interview?
Q:What are your professional goals for the next 3-5 years?
Q: What do you want to work with this organization?
Q: Where do you see yourself five years down the line?
Q:Tell me about something you did recently that was not part of your job?
Q: Tell me about your educational background?
Q:How have you grown in your current job?
Q:What kinds of skills did you use in your past job?
Q:What are you seeking in your next job?
Q:What type of compliments do you receive from your peers or supervisors?
Q:What happens when two priorities compete for your time?
Q:Can you describe a recent situation in which you accomplished an important objective in a brief period of time?
Q: Are you willing to work in shifts?
Q: What is the thing you like the most in the world? Why?
Q: What is the thing you dislike the most in the world? Why?
Q: What are your salary expectations for this job?
Q: What are the projects you have ever undertaken?
Q: How do you define arrogance? Are you arrogant?
Q: What role are you ready to take in a group?
Q: Who has been an inspiration for you?
Q: What is more important to you money or success?
Q: Rate yourself on a scale of 10.

Q:How do you handle repetitive tasks?
Q:Tell me about the last time you missed a goal or deadline.
Q:How do you keep others informed on work issues?
Q:When was the last time something upset you at work? What did you do?
Q:How do you ensure all of your work gets accomplished in a productive manner?
Q:What was the biggest professional risk you have taken and what was the outcome?
Q:Tell me about the last time you had to work with someone inside or outside of your department to accomplish a goal.
Q:Describe a situation where you were successful in directing the work of others.
Q:Describe a situation when you dealt with a difficult person and how you resolved it.
Q:If your supervisor criticized you unfairly, how did/would you handle it?
Q:What do you expect from this job?
Q: Do you know anyone working with this organization?
Q:What do you like best about what you have learned about this job?
Q:What concerns do you have about this job?
Q:What do you see as your primary qualifications for this job?
Q: Why did you choose _________ as your major/subjects?
Q: Are you willing to travel?
Q: Why are you leaving the organization you work for?
Q: How much time do you need to join the organization?
Q: Are you aggressive?
Q: What makes you a good manager?
Q: What motivates you the most?
Q: What skills and abilities do you have?
Q: Is there anything you want to ask?
Q:If you were hired for this job, what areas would you make an immediate impact?
Q:In what areas do you think you will need guidance?
Q:How will you approach learning this “new” job?
Q:How will you approach acquiring new skill sets?
Q:Describe the most difficult situation you have faced in your career and how you managed it.
Q:Describe some problems you encountered in your most recent position and how you resolved them.
Q:What specific steps do you utilize in solving workplace problems?
Q:What are some of the things that you and your supervisor disagree upon and how do you resolve them?
Q:What do you do when you are pressed for a decision?
Q:In your last job what kinds of pressure did you encounter and how did you react?
Q:What kind of work interests you the most?
Q:What kind of work interests you the least?
Q:How would your references describe you?
Q:Name five characteristics that describe you.
Q:Are you a self-starter? Please provide specific examples.
Q:How does your present position differ from past ones?
Q:What would you like to avoid completely in your next job?
Q:What have you done to prepare yourself to be a supervisor?
Q:How do you motivate employees?
Q:What aspect of supervision do you find the most difficult?
Q:What is the most important quality a supervisor should have?
Q:How do you decide what to delegate and to whom?
Q:Why do you feel we should hire someone with your background?
Q:What two accomplishments have given you the most satisfaction?
Q:Why should I hire you?
Q:What makes you better than the other people I’m seeing today?
Q:Give me an example of how you exercised leadership in a recent situation.
Q:Tell me about a time when you were held accountable for a problem that you hadn’t caused.
Q:Think about the changes you have seen and tell me how you handle change.
Q:Tell me about a decision you made recently and how you reached it.
Q:What do you think makes a good manager?
Q:Why did you leave your past jobs?
Q:How did you become interested in this field/industry?
Q:Why did you select the University _______?
Q:If you could do it all over again, how would you plan your academic studies differently?
Q:Assuming that you could do anything you wanted, what would you really like to do in life?
Q:How do you determine or evaluate success?
Q:Who is your hero? Why?

++++++++++++++++++++++++++============================

Freshers ; Programming/theory Questions in c language

1 When is a switch statement better than multiple if statements?

A) switch statement is generally best to use when you have more than two
conditional expressions based on a single variable of numeric type.

2 What is the difference between goto and longjmp() and setjmp()?

A) goto statement implements a local jump of program execution, and the
longjmp() and setjmp() functions implement a nonlocal, or far, jump of program
execution. General…

3 What is an lvalue?

A) An lvalue is an expression to which a value can be assigned. The lvalue
expression is located on the left side of an assignment statement, whereas an
rvalue is located on the …

4 Array is an lvalue or not?
A) An lvalue was defined as an expression to which a value can be assigned. Is
an array an expression to which we can assign a value? The answer to this
question is no, because an array…

5 What is page thrashing?
A) Some operating systems (such as UNIX or Windows in enhanced mode) use virtual
memory. Virtual memory is a technique for making a machine behave as if it had
more memory …

6 What is a const pointer?

A)The access modifier keyword const is a promise the programmer makes to the
compiler that the value of a variable will not be changed after it is
initialized. The compiler will enforc…

7 When should the register modifier be used? Does it really help?

A) The register modifier hints to the compiler that the variable will be
heavily used and should be kept in the CPU’s registers, if possible, so that it
can be accessed faster. There ar…

8 when should the volatile modifier be used?
A) The volatile modifier is a directive to the compiler’s optimizer that
operations involving this variable should not be optimized in certain ways.
There are two special cases in which…

9 Can a variable be both const and volatile?
A) Yes. The const modifier means that this code cannot change the value of the
variable, but that does not mean that the value cannot be changed by means
outside this code. For instance…

10 How reliable are floating-point comparisons?
A) Floating-point numbers are the “black art” of computer programming. One
reason why this is so is that there is no optimal way to represent an arbitrary
number. The Institute of Elect…

11 How can you determine the maximum value that a numeric variable can hold?
A) For integral types, on a machine that uses two’s complement arithmetic
(which is just about any machine you’re likely to use), a signed type can hold
numbers from –2(number of bits –…

12 When should a type cast be used?
A) There are two situations in which to use a type cast. The first use is to
change the type of an operand to an arithmetic operation so that the operation
will be performed properly.&n…

13 When should a type cast not be used?
A) A type cast should not be used to override a const or volatile declaration.
Overriding these type modifiers can cause the program to fail to run correctly.

14 Is it acceptable to declare/define a variable in a C header?
A) global variable that must be accessed from more than one file can and should
be declared in a header file. In addition, such a variable must be defined in
one source file. Variable…

15 What is the difference between declaring a variable and defining a
variable?
A) Declaring a variable means describing its type to the compiler but not
allocating any space for it. Defining a variable means declaring it and also
allocating space to hold the variable

16 Can static variables be declared in a header file?
A) You can’t declare a static variable without defining it as well (this is
because the storage class modifiers
static and extern are mutually exclusive). A static variable…

17 What is the benefit of using const for declaring constants?
The benefit of using the const keyword is that the compiler might be able to
make optimizations based on the knowledge that the value of the variable will
not change. In addition, th…

18 What is the easiest sorting method to use?
The answer is the standard library function qsort(). It’s the easiest sort by
far for several reasons:
It is already written.
It is already debugged.

19 What is the quickest sorting method to use?
The answer depends on what you mean by quickest. For most sorting problems, it
just doesn’t matter how quick the sort is because it is done infrequently or
other operations take sign…

20 How can I sort things that are too large to bring into memory?
A sorting program that sorts items that are on secondary storage (disk or
tape) rather than primary storage (memory) is called an external sort. Exactly
how to sort large data…
21 What is the easiest searching method to use?
Just as qsort() was the easiest sorting method, because it is part of the
standard library, bsearch() is the
easiest searching method to use. If the given array is in th…

22 What is the quickest searching method to use?
A binary search, such as bsearch() performs, is much faster than a linear
search. A hashing algorithm can provide even faster searching. One particularly
interesting and fast method …

23 What is hashing?
To hash means to grind up, and that’s essentially what hashing is all about.
The heart of a hashing algorithm is a hash function that takes your nice, neat
data and grinds it into so…

24 How can I sort a linked list?
Both the merge sort and the radix sort are good sorting algorithms to use for
linked lists.

25 How can I search for data in a linked list?
Unfortunately, the only way to search a linked list is with a linear search,
because the only way a linked list’s members can be accessed is sequentially.
Sometimes it is quicker to …

26 How do you redirect a standard stream?
Most operating systems, including DOS, provide a means to redirect program
input and output to and from different devices. This means that rather than your
program output (stdout) go…

27 How can you restore a redirected standard stream?
The preceding example showed how you can redirect a standard stream from
within your program. But what if later in your program you wanted to restore the
standard stream to its or…

28 What is the difference between text and binary modes?
Streams can be classified into two types: text streams and binary streams.
Text streams are interpreted, with a maximum length of 255 characters. With text
streams, car…

29 How do you determine whether to use a stream function or a low-level
function?
Stream functions such as fread() and fwrite() are buffered and are more
efficient when reading and writing text or binary data to files. You generally
gain better performance by usin…

30 How can I open a file so that other programs can update it at the same
time?
Your C compiler library contains a low-level file function called sopen() that
can be used to open a file in shared mode. Beginning with DOS 3.0, files could
be opened in shar…

31 How can I make sure that my program is the only one accessing a file?
By using the sopen() function you can open a file in shared mode and
explicitly deny reading and writing permissions to any other program but yours.
This task is accomplished by usin…

32 What is Preprocessor?
The preprocessor is used to modify your program according to the preprocessor
directives in your source code. Preprocessor directives (such as #define) give
the preprocessor s…

33 What is a macro, and how do you use it?
A macro is a preprocessor directive that provides a mechanism for token
replacement in your source code. Macros are created by using the #define
statement.
Here is…

34 What will the preprocessor do for a program?
The C preprocessor is used to modify your program according to the
preprocessor directives in your source code. A preprocessor directive is a
statement (such as #define) that …

35 How can you avoid including a header more than once?
One easy technique to avoid multiple inclusions of the same header is to use
the #ifndef and #define
preprocessor directives. When you create a header for your program, …

36 Can a file other than a .h file be included with #include?
The preprocessor will include whatever file you specify in your #include
statement. Therefore, if you have the line
#include <macros.inc>
in you…

37 What is the benefit of using #define to declare a constant?
Using the #define method of declaring a constant enables you to declare a
constant in one place and use it throughout your program. This helps make your
programs more maintainable, b…

38 What is the benefit of using an enum rather than a #define constant?
The use of an enumeration constant (enum) has many advantages over using the
traditional symbolic constant
style of #define. These advantages include a low…

39 How are portions of a program disabled in demo versions?
If you are distributing a demo version of your program, the preprocessor can
be used to enable or disable
portions of your program. The following portion of code shows h…

40 Is it better to use a macro or a function?
The answer depends on the situation you are writing code for. Macros have the
distinct advantage of being more efficient (and faster) than functions, because
their corresponding code…

41 What is the difference between #include <file> and #include “file”?
When writing your C program, you can include files in two ways. The first way
is to surround the file you
want to include with the angled brackets < and >. This me…

42 Can you define which header file to include at compile time?
Yes. This can be done by using the #if, #else, and #endif preprocessor
directives. For example, certain
compilers use different names for header files. One such case is …

43 Can include files be nested?
Yes. Include files can be nested any number of times. As long as you use
precautionary measures , you can avoid including the same file twice. In the
past, nesting header files was s…

44 How many levels deep can include files be nested?
Even though there is no limit to the number of levels of nested include files
you can have, your compiler might
run out of stack space while trying to include an inordinately high nu…

45 How can type-insensitive macros be created?
A type-insensitive macro is a macro that performs the same basic operation on
different data types. This task can be accomplished by using the concatenation
operator to create a call…

46 What are the standard predefined macros?
The ANSI C standard defines six predefined macros for use in the C language:
Macro Name Purpose
_ _LINE_ _ Inserts the current source code line numbe…

47 What is a pragma?
The #pragma preprocessor directive allows each compiler to implement
compiler-specific features that can
be turned on and off with the #pragma statement. For instance, y…

48 What is #line used for?
The #line preprocessor directive is used to reset the values of the _ _LINE_ _
and _ _FILE_ _ symbols,
respectively. This directive is commonly used in fourth-generation…

49 How do you override a defined macro?
You can use the #undef preprocessor directive to undefine (override) a
previously defined macro.

50 How can you check to see whether a symbol is defined?
You can use the #ifdef and #ifndef preprocessor directives to check whether a
symbol has been defined
(#ifdef) or whether it has not been defined (#ifndef).
51 What is the difference between a string copy (strcpy) and a memory copy
(memcpy)? When should each be used?
The strcpy() function is designed to work exclusively with strings. It copies
each byte of the source string to the destination string and stops when the
terminating null characte…

52 How can I convert a number to a string?
The standard C library provides several functions for converting numbers of
all formats (integers, longs, floats, and so on) to strings and vice versa

53 How can I convert a string to a number?
The standard C library provides several functions for converting strings to
numbers of all formats (integers, longs, floats, and so on) and vice versa.

54 How do you print only part of a string?
/* Use printf() to print the first 11 characters of source_str. */
printf(“First 11 characters: ‘%11.11s’n”, source_str);

55 What is indirection?
If you declare a variable, its name is a direct reference to its value. If you
have a pointer to a variable, or any other object in memory, you have an
indirect reference to its valu…

56 How many levels of pointers can you have?
The answer depends on what you mean by “levels of pointers.” If you mean “How
many levels of indirection
can you have in a single declaration?” the answer is “At least 1…

57 What is a null pointer?
There are times when it’s necessary to have a pointer that doesn’t point to
anything. The macro NULL, defined in <stddef.h>, has a value that’s guaranteed
to be different from …

58 What is a void pointer?
A void pointer is a C convention for “a raw address.” The compiler has no idea
what type of object a void
Pointer “really points to.” If you write
int *ip; …

59 Is NULL always defined as 0?
NULL is defined as either 0 or (void*)0. These values are almost identical;
either a literal zero or a void pointer
is converted automatically to any kind of pointer, as…

60 What does it mean when a pointer is used in an if statement?
Any time a pointer is used as a condition, it means “Is this a non-null
pointer?” A pointer can be used in an
if, while, for, or do/while statement, or in a conditional …

61 Can you add pointers together? Why would you?
No, you can’t add pointers together. If you live at 1332 Lakeview Drive, and
your neighbor lives at 1364
Lakeview, what’s 1332+1364? It’s a number, but it doesn’t mean a…

62 How do you use a pointer to a function?
The hardest part about using a pointer-to-function is declaring it.
Consider an example. You want to create a pointer, pf, that points to the
strcmp() function.

63 When would you use a pointer to a function?
Pointers to functions are interesting when you pass them to other functions. A
function that takes function pointers says, in effect, “Part of what I do can be
customized. Give me a …

64 Why should we assign NULL to the elements (pointer) after freeing them?
This is paranoia based on long experience. After a pointer has been freed, you
can no longer use the pointed-to data. The pointer is said to “dangle”; it
doesn’t point at anything us…

65 Is it better to use malloc() or calloc()?
Both the malloc() and the calloc() functions are used to allocate dynamic
memory. Each operates slightly different from the other. malloc() takes a size
and returns a pointer to a ch…

66 What is the difference between far and near?
As described at the beginning of this chapter, some compilers for PC
compatibles use two types of pointers.
near pointers are 16 bits long and can address a 64KB range. …

67 When should a far pointer be used?
Sometimes you can get away with using a small memory model in most of a given
program. There might be just a few things that don’t fit in your small data and
code segments. When that…

68 What is the stack?
The stack is where all the functions’ local (auto) variables are created. The
stack also contains some
information used to call and return from functions.
A…

69 Can the size of an array be declared at runtime?
No. In an array declaration, the size must be known at compile time. You can’t
specify a size that’s known
only at runtime. For example, if i is a variable, you can’t wr…

70 What is the heap?
The heap is where malloc(), calloc(), and realloc() get memory.
Getting memory from the heap is much slower than getting it from the stack. On
the other hand, the heap <…

71 What is the difference between NULL and NUL?
NULL is a macro defined in <stddef.h> for the null pointer.
NUL is the name of the first character in the ASCII character set. It
corresponds to a zero value. Ther…

72 What is a “null pointer assignment” error? What are bus errors, memory
faults, and core dumps?
These are all serious errors, symptoms of a wild pointer or subscript.
Null pointer assignment is a message you might get when an MS-DOS program
finishes executing. Some…

73 How can you determine the size of an allocated portion of memory?
You can’t, really. free() can , but there’s no way for your program to know
the trick free() uses. Even if you disassemble the library and discover the
trick, there’s no guarantee th…

74 Can math operations be performed on a void pointer?
No. Pointer addition and subtraction are based on advancing the pointer by a
number of elements. By definition, if you have a void pointer, you don’t know
what it’s pointing to, so y…

75 How do you print an address?
The safest way is to use printf() (or fprintf() or sprintf()) with the %P
specification. That prints a void
pointer (void*). Different compilers might print a pointer wi…

76 Why should I prototype a function?
A function prototype tells the compiler what kind of arguments a function is
looking to receive and what
kind of return value a function is going to give back. This appr…

77 What is a static function?
A static function is a function whose scope is limited to the current source
file. Scope refers to the visibility
of a function or variable. If the functio…

78 Is it possible to execute code even after the program exits the main()
function?
The standard C library provides a function named atexit() that can be used to
perform “cleanup” operations when your program terminates. You can set up a set
of functions you want to…

79 Is using exit() the same as using return?
No. The exit() function is used to exit your program and return control to the
operating system. The return
statement is used to return from a function and return contro…

80 Can the sizeof operator be used to tell the size of an array passed to a
function?
No. There’s no way to tell, at runtime, how many elements are in an array
parameter just by looking at the
array parameter itself. Remember, passing an array to a functi…
81 Is it better to use a pointer to navigate an array of values,or is it better
to use a subscripted array name?
It’s easier for a C compiler to generate good code for pointers than for
subscripts.

82 What is the difference between a string and an array?
An array is an array of anything. A string is a specific kind of an array with
a well-known convention to
determine its length.
There are two kinds of progr…

83 what is a modulus operator? What are the restrictions of a modulus
operator?
A Modulus operator gives the remainder value. The result of x%y is obtained by
(x-(x/y)*y). This operator is applied only to integral operands and cannot be
applied to float o…

84 why n++ executes faster than n+1?
The expression n++ requires a single machine instruction such as INR to carry
out the increment operation whereas, n+1 requires more instructions to carry out
this operation.

85 Write the equivalent expression for x%8?
x&7

Write expressions to swap two integers without using a temporary variable?

86 Which expression always return true? Which always return false?
expression if (a=0) always return false
expression if (a=1) always return true

87 What is storage class and what are storage variable ?
A storage class is an attribute that changes the behavior of a variable. It
controls the lifetime, scope and linkage.
There are five types of storage classes
1)au…

88 What are the advantages of auto variables?
1)The same auto variable name can be used in different blocks
2)There is no side effect by changing the values in the blocks
3)The memory is economically used

89 Diffenentiate between an internal static and external static variable?
An internal static variable is declared inside a block with static storage
class whereas an external static variable is declared outside all the blocks in
a file.An internal static variable has persis…

90 What are advantages and disadvantages of external storage class?
Advantages of external storage class
1)Persistent storage of a variable retains the latest value
2)The value is globally available

Disad…
91 Differentiate between an external variable definition and external variable
declaration

92 Differentiate between a linker and linkage?

A linker converts an object code into an executable code by linking together
the necessary build in functions. The form and place of declaration where the
variable is declared in a program determine …

93 What are the characteristics of arrays in C?

1) An array holds elements that have the same data type
2) Array elements are stored in subsequent memory locations
3) Two-dim…

94 When does the compiler not implicitly generate the address of the first
element of an array?
Whenever an array name appears in an expression such as
Ø array as an operand of the sizeof operator
Ø array as an …

95
What is modular programming?

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 mo…

96 What is a function and built-in function?

A large program is subdivided into a number of smaller programs or
subprograms. Each subprogram specifies

HR questions

Appl

Deshaw

Desha

Apt5

Cfaq

INTGRAH

HUGHES

Hcl

Emacs~1

Easi1

Baan

23/09/2011

TCS Internal Papers Pre-ILP – Intial-Exercise-Set[1]

TCS Internal Papers Pre-ILP PhaseI[1]

TCS Internal Papers Pre-ILP PhaseII[1]

TCS Internal Papers Pre-ILP PhaseIII[1]

44 thoughts on “Campus Papers

  1. sir please upload this program into this site

    11) Write a program which consumes array of numbers(reading element by element) and returns each element of the array and it’s number of occurrences in the array
    Say if the input array is A[1 2 3 4 3 5 2 1 6]
    Output will be 1 two occurrences , 3 two occurrences….

  2. hi ! sir i want extra question papers of operators , looping and decision making apart from the class papers which you have given.

  3. hi ! sir i want extra question papers of operators , looping and decision making apart from the class papers which you have given.

  4. good evening sir can you please explain me about program on caluculating big day using switch condition

  5. hi sir
    am ur c++ student of 2:30 batch……
    am very gud at c but i am not dat much of thorough of data structures concept…….
    will u plz send me d related material of dat…..

  6. Sir u r really god of the software
    Still i am not believe myself that i am writing programs for big patterns not others only me though i am belongs to ECE
    Thank q so much for ur extraordinarily classes

  7. sir,,,iam a ur previous batch student at 11am to 2pm,,,,i wnt more example logics on while loop concepts for preparing to interview and nacre purpose,,,
    ex: 1 1
    2 3 0 1
    4 5 6 1 0 1
    7 8 9 10,, 0 1 0 1
    1 0 1 0 1 etc,,so many exampls plss sir
    email:rupeshdhondi@gmail.com

  8. sir i am not able to read complete answer can u please tell me how to read the total answers;……

    thank u very much u r providing us very good platform to learn

  9. Respected sir,
    from your notes i got “for turbo c 3.0, it has 1MB residence memory ie when we open turbo c 3.0 it stores 1 MB in the RAM”
    sir plz can u tell me the reference book for this i want to know these things in detail.

  10. Respected sir,
    I am u r last month i.e. Datastructure through c batch student. Now I am in maharashtra persuing MCA -2 year. In Dec 2013 Quick Heal Company will come in our compus for placement so how should i prepare for that? actually i already completed U R c and C++ batches and in last year 2012. So i have learned more concept in that classes.
    But now i am preparing for Quick Heal Company so can u upload some more placement
    papers? besides that can u suggest me which books for c,c++,DS through C++ i should refer?

    If u don’t mind sir, but i want to express something sir that whatever i got in hyderabad i.e. your valulable guidance and inspirations when i was attend your lectures. Here also i attend college lectures but I am not getting that much output whatever i gots in attending your batch.

    I always pray to my god that My GURU get happy life and health .Beside that i desire from god in my whole life anywhere i should get GURU like You.

    when i get fill lonely that time i always realize your lectures and your inspirations. In my life i want to become as you. My parents and you are my GOD.

  11. Respected sir,

    i have sent you one java program through DropBox.
    please download it.
    ——————-
    setps to execute
    ——————-
    1) open the folder “Wada Cum”
    2) double click on “z DoubleClick Me”

    Are you teaching in Naresh these days. i have not gone to
    Naresh since 2 months. i am preparing myself.

    sir i am still in Core java.
    but this time i have covered most of the chapters.
    remaining are
    1) 50% of Collection(i left collection preparation to attend compete class of Hari sir).
    2) more Generics from Khalid mougal book.
    3) more IOstreams from Khalid mougalbook and API methods execution.
    4) more work on Wrapper Class.
    5) more work on String,StringBuilder,StringBuffer
    6) little Networking Chapter.
    7) complete Regular Expression need to learn.

    apart from all these i have covered all the concepts in Java perfectly.
    my time schedule is missing due to some and some reason. like recently
    i spent nearly 15 to 20 days on AWT,APPLET,SWING which are not required
    in interview but it is part of Corejava and due to this i could develop one
    program and sent it to you.

    but i have to work without loosing time, then how much time it will take,
    that is normal time for me.
    i am hoping still some 10 to 11 months to get complete confidence on java.

    i was perfect in 100%Oracle,95%Hibernate,60%Spring,60%struts,60%adv java.
    now i have to make it 100% with revision and fresh attending classes.

    these days i am not attending any class, sometimes felling bore without class
    environment. but i will not go for adv java without complete knowledge of Corejava.

    i need your blessing sir, it may be invisible but it will work like god’s blessing.

    good bye sir

  12. I am always with you sir, i know you are the best in your technologies. i will say to all my friends to join your batches ,who r looking for deep knowledge in c/c++ & d.s.

Leave a reply to santhosh kumar Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.