Showing posts with label Interviews. Show all posts
Showing posts with label Interviews. Show all posts

Citrix Written Test Questions-1

1. What is the output of this statement ?
Printf(“%d”,printf(“%d %d”,2,2) & printf(“%d %d ”, 2, 2));
a. 22222
b. 22221
c. It will give an error during compilation

2. What is the output of this code snippet

main()
{ int *p[10];
printf("%d %d\n",sizeof(*p),sizeof(p));
}

3. Function inlining is best used when
a. In a small recursive function
b. In large function where number of variables used is small
c. In a large function where there are many loops and number of variables used is small
d. None of these

4. If there is a large quantum in round robin it will be equivalent to
a. First come first serve
b. Shortest job first
c. Least recently used
d. None of these

5 . which of the following will lead to starvation
a. Fifo
b. Shortest job first
c. Round robin
d. Least recently used

6 . if the address space is 192.168.36.16/28 which of the following is the broadcast ip
a. 192.168.36.0
b. 192.168.36.1
c. 192.168.36.255
d. 192.168.36.31

7. if there are 9 yellow balls, 3 red balls and 2 green balls. What is the probability that the second ball picked is yellow given the first ball is yellow
a. 8/13
b. 9/13
c. 8/14
d. 9/14

8. How many processes are created in this snippet?
Main()
{
Fork();
Fork() && fork () || fork ();
Fork ();
}

a. 15
b. 19
c. 21
d. 27
e. 31

9. which of the following is TRUE about the declaration const char * p
a. the pointer cannot be changed but the value to which it points can be changed
b. the value is constant but the pointer can be changed
c. neither the value nor the pointer can be changed
d. none of these

10. If F and L are the pointers to the first and last elements in a linked list, then which of the following operations is dependent on the length of the list?
a. delete the first element in the list
b. insert a new element as a first element
c. delete the last element of the list
d. add a new element at the end of the list

Citrix Written Test Questions-2

11. Find the slope of the line joining the points (0,2) and (3, -2)
a. -4/3
b. ¾
c. -3/4
d. 4/3

12. Solve for x in x^3+3x^2+5x+9=6
a. -1
b. 1
c. -2
d. -3

13. 73 to the base x is equivalent to 51 to the base y. which of the following may be the possible values of x and y
a. 10, 12
b. 8, 16
c. 9, 13
d. 8, 12

14. Which of the following is independent of the operating system and machine architecture
a. linker
b. loader
c. compiler
d. debugger

15. Which of the following restricts a process to the memory allocated to it
a. stack pointers
b. memory allocation hardware
c. kernel
d. none of these

16. When a user logs out, what happens to the processes created by him?
a. they’ll be killed
b. aborted
c. hang
d. none of these

17. What is the output of
Main()
{
Struct node {
Int a;
Int b;
Int c;
};
Struct node a = {2,4,5};
Struct node *st;
St = &a;
Printf(“%d”, *(int *)st);
}
a. 2
b. 3
c. 7
d. 11

18. What is the output of
Struct outer{
Struct inner{
Int a = 10;
}
Int b = 5;
}
Main()
{
Struct inner new;
Printf(“%d”, new.a)
}
a. It will give a compilation error
b. 10
c. 5
d. 15

19. Thrashing is solved by
a. increasing cpu bound processes
b. reducing the degree of multi-programming
c. increasing user processes
d. none of these

20. If t` is the reverse of t then what is the reverse of trs
a. s’r’t’
b. srt
c. t’r’s’
d. t’rs’

Cisco Interview Questions

1)Explain an algorithm for path planning in a given map.

2)Write a code to find the shortest path in a given graph.

3)Write a code for minimal spanning tree

4)How do you find existence of a cycle in the given graph.

5)Explain OSI model.

6)How do you find out the sizeof an object in Java.

7)Given a byte, write a code to swap every two bits. [Using bit operators] Eg: Input: 10 01 11 01 Output: 01 10 11 10

8)Write a Shell code which takes in as input several files and replaces each occurance of word “Nishant” with word “reddy”.

9)What is VPN ?

10)What are TCP/IP protocol , Routing algorithms , P2P file sharing , Routing protocols.

11)Implement the above protocols in C.

CapitalIQ Interview questions

1. How are databases stored internally ?

2. Can you think of any improvements to the storage of databases

3. What is indexing in databases and how does it help ?

4. Differences between search engine index and database index ?

5. What is paging in operating system ?

6. Explain the difference in different types of pagings in different situations – Constraints on the implementation

7. How can you implement paging in databases ?

8. What happens when you search for a value in a database ?

9. What are the different types of cache available .. explained about L1 L2 and onchip offchip caches and their access times and cost

10. What is an RDBMS ? What are the differences or relation between RDBMS and DBMS ?

11. What are the different types of joins in a database. Explained every join[Natural,Inner outer etc ., ] with examples.

Infosys Setlabs Campus Interview

Written test was on aptitude and verbal. Its was more like a cat paper.

There was one round of interview (kinda stress mostly on the projects).

Questions:

1) Tell me about yourself
2) Tell me the projects you worked on
3) Which project did you like the most and why ? He will ask you questions about your projects, why did you do this why not in this way …
4) Ur future plans.
5) Why Setlabs ?

ADP Campus Interview

Technical Interview

1) What are the ways of representing floating point nos?

2) What are various Datatypes?

3) Write the code for tic-tac-toe game, 8 queens problem.

4) Write the psuedo code for towers of hanoi and what if there were 4 towers instead of 3.

HR Interview

1) What do you know about ADP?

2) What is your dream company? and Why?

3) How did you come to know about ADP? If you heard about this from your seniors, who are they and what did they tell you?

4) And some common questions like Tell about yourself, Family Background etc.. and also the interviewer asks if you have any questions for him.

Yahoo Interview Questions-2



  1. Design a data structure such that given a stream of numbers, you can find the maximum of the numbers at any point and also all the numbers.


  2. Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions.

  3. Find the common ancestor of two given nodes in a binary tree, how do you exploit the properties of a given BST for the same problem.

  4. Given a function getsort(data),that sorts the data given. The function sorts in place and does not use any extra memory. How do you validate the function with respect to 1)it sorts 2) it does not use extra memory

  5. Explain the Traveling Salesman problem? What is an NP-complete problem? What is the Hamiltonian cycle problem?

  6. Find out the least common ancestor in a binary tree.

Yahoo Interview Questions-1


  1. A modified insertion sort uses binary search to find the position of insertion. What would be the improvement in order realized?

  2. class a{};
    main()
    {
    count <<>
    }
    What is the output?

  3. The linked list size is unknown and it is very large. Find out the N th element from the back end.

  4. What happens in the following code?
    char x[10],y[10];
    x=y;

  5. Design a stack which supports push, pop, min and max operations in O(1).

  6. Design an NFA to accept a string of 0s and 1s.

  7. Given a balanced BST tree, write a function to replace the root with a node that belongs to the original tree.

  8. Explain what this function does

    char *mystrcpy(char *s)
    {
    char des=char [MAXLEN];
    char * t=des;
    while(*s)
    {
    *++t=*++s;
    }
    return t;
    }


  9. Given that you have a server hit by around 400 million users, and you have log files that contain the user ids of all of them. How do you find the frequency of login of each user. (The log files are very huge!!)

  10. Explain Polymorphism, Encapsulation, Inheritance, operator overloading?

Latest DE Shaw Interview Questions

Question1: Differentiate HTTP and HTTPS

Question2: Discuss ACID properties of a database system.

Question3: Given a table Employee with only one field: Names, report all names with multiple entries.

Question4:Given two sequences s1,s2 and another sequence s3, find if s3 is formed by interleaving s1 and s2.[Example: s1:abcd s2:bcaa s3:abbccdaa].

Question5: If a class B is inherited from a class A, B has a function foo which is also in A, how do you call foo function in A??

Question6: If a class B is inherited public from a class A, what all the variables that can be accesses and those that cannot be.

Question7: List out the additional features of C++ over C when the latter is already available as a good programming language?

Question8: Can classes,protected variables or other features in C++ be implemented using C?

Question9: Define Deadlock

Question20:Given a multi-threaded program How can you make it run on a system that supports only a single thread execution?

Question11:What are the Differences between a const char * and char const *?

Question12:What are the Differences between a reference variable and pointer variable in C++?

Question13What is a register variable and what are the limitations on it? What is an automatic variable?

Question14What are the Differences in memory allocation in array and pointer(stack and heap)?

Question15Find the missing element in a sorted array in most optimum running time (O(log n))

Latest Amazon Interview Questions -3

1. How would you find the second largest element in an array using minimum no of comparisons?

2. Write a C program for level order traversal of a tree?

3. You are given: 3 types of vehicles: Motorbike, Car, and a special type of car for the handicapped.
3 types of parking: Motorbike parking, Car parking, handicapped car parking.

Motorbikes and cars can only park in their designated parkings, while the handicapped cars can park either in their own parking or the regular car parking.
How would you model this as classes? Explain your methods.


4. Given 2 tables: Employee(Employee_Name,Dept_No) Department(Dept_No, Dept_Name)

Write an SQL query which outputs all the employees, and their department nos and names, including all those departments which have no employees working for them.

6. Explain about Inodes?

7.Give a Linux shell command to find all files in a directory which contain ip addresses.

8. Given a table Employee which has columns name and salary, write an SQL query to find the employee with the second highest salary.

9. Given a table of Player which contains Sno and player name, write a query which finds all possible Table Tennis doubles pairings.

10.Given a string A, and a string B, and a dictionary, how would you convert A to B in the minimum no of operations, given that:

i) All the intermediate words must be from the dictionary

ii) An ‘operation’ is defined as:

a) Delete any character from a string ex dog → do

b) Insert any character into a string ex cat → cart

c) Replace any character in the string with another ex cat → cot

Latest Amazon Interview Questions -2

1.Given a string,find the first un-repeated character in it? Give some test cases

2.You are given a dictionary of all valid words. You have the following 3 operations permitted on a word:

a) Delete a character

b) Insert a character

c) Replace a character

Now given two words - word1 and word2 - find the minimum number of steps required to convert word1 to word2. (one operation counts as 1 step.)


3.Given a cube of size n*n*n (i.e made up of n^3 smaller cubes), find the number of smaller cubes on the surface. Extend this to k-dimension.

4.What is a C array and illustrate the how is it different from a list.

5. What is the time and space complexities of merge sort and when is it preferred over quick sort?

6. Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

7. Given n red balls and m blue balls and some containers, how would you distribute those balls among the containers such that the probability of picking a red ball is maximized, assuming that the user randomly chooses a container and then randomly picks a ball from that.

8.Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

9. Given an array of size n ,containing every element from 1 to n+1, except one. Find the missing element.

Latest Amazon Interview Questions -1

1. How do you convert a decimal number to its hexa-decimal equivalent.Give a C code to do the same

2. Explain polymorphism citing an example.

3. What are the 4 basics of OOP?

4. Define Data Abstraction. What is its importance?

5. Given an array all of whose elements are positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should be adjacent in the array.

Eg.

i) 3 2 7 10 should return 13 (sum of 3 and 10)

ii) 3 2 5 10 7 should return 15 (sum of 3, 5 and 7)


6. Given a Binary Search Tree, write a program to print the kth smallest element without using any static/global variable. You can’t pass the value k to any function also.

7.You are given some denominations of coins in an array (int denom[])and infinite supply of all of them. Given an amount (int amount), find the minimum number of coins required to get the exact amount. What is the method called?

8.Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 1 number. Find the missing number.

9.Given an array of size n. It contains numbers in the range 1 to n. Each number is present at least once except for 2 numbers. Find the missing numbers.

10.Given an array of size n. It contains numbers in the range 1 to n. Find the numbers which aren't present.

DE Shaw Interview Questions-2

1)Explain the ACID properties of a database system.

2)Given a single field table,the field being Names, report all names with multiple entries.

3)Explain the notion of deadlocks and their causes?

4)Give the differences between thread and a process?

5)Give difference between a const char * and char const *

6)Give Difference between a reference variable and pointer variable in C++

7)Explain the issues in memory allocation in an array and a pointer.

8)Explain about Priority Inversion.

9)Explain about virtual classes in C++

10)What is a register variable and how is it different from a automatic variable?

DE Shaw Interview Questions

1)Give difference between structure and union and demonstrate union uses with examples.

2)Given a triangle, how do you divide it into 5 triangles of equal area?

3)Given a linked list,find whether a loop exists in it or not,if yes then return a pointer to the start node of the loop?

4)Give a pseudo code to reverse a linked list using recursion.

5)Give a data structure using stack to implement push,pop,min as O(1) operations.

6)Given an array of integers, for each element report the corresponding nearest element greater than it and to the right side of it or a -1 if there exists no such element.
Sample: input: 4 6 2 7 5 4 6 2 output: 6 7 7 -1 6 6 -1 -1

7) Implement a stack using a queue.

8)Throw some light on TCP Handshaking.

9)Throw some light on Denial of service.

10)Give differences between HTTP and HTTPs


more questions to be added

Interviewer's Guide

These are the general views of an Interviewer before,during and after an interview [in interviewer's point of view].

Interviewer's Guide Before the Interview

How would I create questions to evaluate interpersonal skills?

This depends on what work habits you include in your definition of interpersonal skills. Do you mean: teamwork; motivation; leadership; problem solving; empathy; adaptability; verbal communication; etc.? It would take about 10 pages of type to respond to your question without more information. There are 35 of these work habits included in the appendix of "High Impact Hiring." Please get a copy of the book and look at the list of work habits there. Then select 10 or 12 questions from the 175 samples included in the book.

What type of questions will tell me if a person is detail-oriented?

Try these questions:

Have the jobs you held in the past required little attention, moderate attention, or a great deal of attention to detail? Give me an example of a situation that illustrates this requirement.

Do prefer to work with the "big picture" or the "details" of a situation? Give me an example of an experience that illustrates your preference.

Tell me about a situation where attention to detail was either important or unimportant in accomplishing an assigned task.

Describe a situation where you had the option to leave the details to others or you could take care of them yourself.

Tell me about a difficult experience you had in working with details.

What type of questions will tell me if a person is self motivated?

Here are just a few examples: "Tell me about a time when you went out of your way to complete an assignment?" "Give me an example of a time when a project really excited you?" "Describe a time when you were unmotivated to get a job done?" "Tell me about a time when you did more than was expected of you." "Tell me about a time when you were given an assignment that was distasteful or unpleasant." Get the idea?

What's your opinion of having an applicant go through a timed writing/problem-solving exercise and asking questions based on the written product?

I have no problem with this approach as long as you can demonstrate that the exercise is job-related and you're clear about what knowledge or information you are looking for. If you plan to make this a part of your interview, be sure to administer this exercise to ALL candidates. I also encourage you to get work samples from a job candidate anytime you can. In addition, there are a number of standardized tests that you can include as part of your interview process.

How should I use a telephone interview?

Use the telephone interview to:

1. Fill in missing information on the candidate's resume;
2. Question the candidate to determine his/her level of interest;
3. Get a feeling for the candidate's communication skills;
4. Ask some questions to get a sense of the candidate's technical qualifications;
5. Decide whether to invite the candidate for a personal interview.

I was just hired as a supervisor and will be interviewing soon. How can I come up with the right questions to ask?

You can start by reviewing (or writing) the job description. Identify the key duties and responsibilities. Then decide what skills are needed to perform these key duties and responsibilities. Finally, draft some open ended interview questions that will make it necessary for the candidate to explain how they have actually applied these skills in the past.

How many questions should I ask in an interview?

Twelve to 20 experience based questions is about all you can ask in an interview that lasts from 45 minutes to 1 1/2 hours. However the number of questions you ask is based on the number of distinct skills that you are looking for. For each interviewer on your team, you should prepare at least two questions per skill that the interviewer is responsible for assessing. For example, if my team was made up of three interviewers and we were all gathering data about the same six skills, I would need to develop 36 questions (3 interviewers x 6 skills x 2 questions/skill).

Also, Don't give any two interviewers the same questions to ask. The idea is to get as much data from a candidate as you can without giving the candidate and opportunity to rehearse. If more than one interviewer asks the same question, you can see how this might compromise the quality of the data you get.

Would you recommend a structured interview?

Absolutely! I'm a strong believer in structured interviews, that is, interviews where the questions have been developed based on a well done job-skills analysis. This is the best way to insure that your interviews will be complete, consistent, and fair. Also, you will find it much easier to evaluate each candidate's qualifications based on their responses to your questions. My book "High Impact Hiring: How to Interview and Select Outstanding Employees," will give you all the tools you need to create high quality structured interviews that get results.

What is the value, if any, of questions like; "If you were an animal in the zoo, what animal would you be?

Zero value. These questions only satisfy an interviewer's need for ego gratification. The biggest problem with a question like this is that it has no "face validity." The candidate has no idea how to answer such a question and these questions smack of amateur psychology. My advice: stick to open-ended questions that require a candidate to describe specific job related events that reflect on their skills.

I am currently conducting a seminar on interviewing/recruiting. I need some examples of probing thoughtfully and any other suggestions on that topic.

I'm assuming by "probing thoughtfully," you are asking about techniques to get more detailed information about a candidate's response to an interview question. The process I recommend requires that you first ask the candidate to describe a specific job related experience (we call this a "behavior based question"). Here's an example: "Tell me about a time when you had to deal with a disagreeable person." In order to get complete information you'll need to ask the candidate to tell you such details as: who was involved, where did the event take place, when did it take place, what led up to this situation, what actions were taken by all parties, what was the final outcome.

In your book "High Impact Hiring" you recommend using a behavior based interview. Why?

A behavior based interview is the most practical for people who do not conduct interviews as a profession. This type of interview helps you focus on "what" a person can do (i.e. the skills they have) vs. "why" they do it. Behavior based interviews take advantage of the fact that people are creatures of habit and repeat patterns of behavior over and over. So, if we can get job candidates to recall specific job-related events, we can use this information to predict how a person will perform in a similar situation in the future.

Interviewer's Guide During the Interview:

What non-verbal signs do you look for while interviewing?

I'm not too concerned about nonverbal signs unless I see a definite conflict between what a person is saying and what their body language is telling me. If I see a large contrast, it's a signal for me to get more detail about the experience the candidate is describing to me. I also might ask the candidate for a reference in order for me to verify the facts I am being presented with. I do pay attention to body posture, tone of voice, and verbal pace. I like to mirror my candidates posture, tone, and pace in order to more effectively communicate with her/him.

The environment I work in is constantly changing (policy, leadership, etc.). I'm trying to find a question that would help determine a candidate's tolerance of change. Can you help?

Try some of these questions.

"Tell me about a time when you experienced a sudden or dramatic change in your workplace that had a significant impact on you."

"Summarize your experience working in a rapidly changing environment."

"Describe a situation you faced where it was difficult to cope with a change that was thrust upon you."

We have high turnover due to high level of "nasty" customers we have to handle. What type of questions would be good in determining what candidates are good at handling these people?

Before you begin to deal with the issue of "questions," you should ask yourself (and anyone who has in-depth knowledge of this position) -- "What personal characteristics (we call these Work Habits) are required of the jobholder in order to be successful?"

Your list might look something like this:

* Tolerant
* Slow to Anger
* Tactful
* Empathic
* Caring
* Friendly
* Confident

With the Work Habits identified, you now can develop a series of open-ended questions that will enable you to evaluate the match between a candidate's qualifications and the requirements of the job. Here are a few sample questions:

1. Tell me about a time a customer was rude or obnoxious on the telephone.
2. Describe a situation where you were close to losing your temper with an unhappy customer.
3. Now tell me about a time when a customer "pushed you over-the-edge" and you lost your temper.
4. Describe a situation where you where you found it necessary to refuse an unreasonable customer request.
5. Tell me about a time when you where successful in dealing with a very "nasty" customer.
6. Describe a situation where you went out of your way to accommodate a demanding customer.
7. Tell me about a time when you were able to become a friend to a customer who needed to feel that you cared about their problem.

Get the idea? Remember, these questions will get you information about a candidate's Work Habits, but not much information about their Technical Skills. You'll need to develop a list of these skills and create some questions that focus on the technical requirements of the job in order to build a more complete interview.

You recommend in your book (High Impact Hiring) informing the candidate they can look at the notes after the interview. I was wondering if you could just give me a few pointers on what notes to take?

All you need to include in your notes are description of the experiences that the candidate describes to you. I just list enough information in order to recall the experience when it comes time to evaluate the candidate's skills. For each example the candidate gives me, I like to know who was involved, where the event took place, when it took place, and what led up to this situation. I also want to know what steps the candidate took and what actions other's took in order to clearly understand the candidate's role. Finally, I ask about the outcome.

It's not necessary to include descriptions of the candidate's actions during the interview. That's not very helpful in evaluating their skills. Also, don't record evaluation or judgments in your notes. The time to judge comes after the interview is over.

One final point. Be sure to let the candidate know you will be taking notes so that you can remember the important details that the candidate shares with you during the interview.

How should I start the interview? Should I ask a question to help the person relax?

Start with a warm welcome to the candidate. Invite them to be seated and offer a refreshment. It's okay to ask questions like: "How was your trip? or Did you have any difficulty finding us?" Avoid questions or comments that relate to family or marital status, religion, or national origin. Continue with a brief self introduction explaining how you fit into the organization and describe your role in the interview. Briefly review the key duties and responsibilities for the job. Review the agenda for the interview and the schedule for the day. This should take no more than five minutes and now, you're ready to begin finding out about the candidate's qualifications.

How do you stop an applicant from giving run-on, rambling answers that don't answer the question?

Many applicants give rambling answers because they don't have a clue as to the level of detail you are looking for. A second reason may be that your questions are not focused on gaining information about a single skill but on a constellation of skills. A third possibility is that you are not asking behavior-based questions that require the candidate to describe in detail a single work experience. Finally, you need to tactfully interrupt a rambling candidate in order to maintain control of the interview. You might say something like, "That's interesting, but let's get back to the main point," or "You seem to be confused about what I'm asking. Let me clarify..."

How can I tell if a applicant is lying in the job interview?

There is a tried and true way to determine if an applicant is lying. Ask the applicant to describe a work experience they have had that is related to a specific job related skill you are attempting to evaluate. As the candidate responds, probe for detailed information. Be sure to take notes as the candidate responds. Then say, "Who can I talk to in order to verify the information you have just given me?" Be sure to contact this person as part of your reference checking process.

Interview's Guide After the Interview:

What questions are you allowed to ask the candidates' references as well as what information references are allowed to give?

"References" are often reluctant to give you information because they fear that they may be subjected to a lawsuit or other legal action. Fortunately, in most states, the reference provider is protected by law unless this person gives false or slanderous information.

Ask references to verify information you have received about the candidate's qualifications during the interview. I would also ask open-ended questions such as: "Tell me about this person's most valuable contribution. Summarize this person's performance in the technical aspects of the job. How well did this person's work habits help or hinder her/him? In what areas would this person benefit from additional training or coaching?"

Finally, ask: "Who else should I contact regarding this person's past performance?"

This is a brief description of the process you should follow. See "High Impact Hiring" for a more complete treatment of this subject.

How do I tell an applicant that they didn't get the job?

Before you contact the candidates that have not been selected, be sure that your selected candidate has been presented with and accepted your offer in writing. Following this, it's up to you to decide whether to contact the others by telephone. In any case, you should follow-up with a letter. It's not necessary to explain why the person was not hired unless you feel compelled to do so. In any case, your follow-up letter should remind the candidate that your company may be interested in talking with them should an appropriate opening become available.

Here's a sample script for a telephone contact.

"Hello , this is from . I'm calling to bring you up to date on the selection process for the position of you applied for. We were very fortunate to have an opportunity to talk with you and the other candidates and thank you for your interviewing with us. , I have selected another candidate for this position based on the best match between this person's qualifications and the requirements of the job. I wish you all the success in your current job search."


Courtesy: www.job-interview.net/interviewer.htm

General Technical Questions

What is the difference between shadow and override?

Overriding is used to redefines only the methods.but shadowing redefines the entire element.

You have an event handler called MyEvent and you want to link the click event of control, MyButton, to use MyEvent, what is the code that will like them together?

control.Click += new EventHandler(MyEvent)

Which debugging window allows you to see the methods called in the order they were called?

The call stack.

Which debugging window allows you to see all the name and values of all the variables in scope?

In Call stack window in MS Visual Studio IDE.

What is wrapper class?is it available in c#?

Wrapper Classes are the classes that wrap up the primitive values in to a class that offer utility method to access it . For eg you can store list of int values in a vector class and access the class. Also the methods are static and hence you can use them without creating an instance . The values are immutable .

What is protected internal class in C#

Class can be internal not protected or not even protected internal. Class can have only two access modifiers Public and internal.if any field or method having access modifier protected internal then this field available to the others assemblies class and as well as class whose inharits this class.

Which keyword is used of specify a class that cannot inherit by other class

By using "sealed" keyword we can restrict a class from inheritence.

Can u create the instance for abstract classes

No we cannot instanciate abstract class we hav to extend it first

ex-

abstract class A

{}

class B : A

{}

Class C

{

B b=new B;

}

Can we use Friend Classes or functions in C# the way we use it in C++

No we can not use friend keyword but instead c# provide "internal" keyword for friend

How we can use inheritance and polymorphisms in c# programming?

Inheritance in C# is similar to cpp, if you are familiar to cpp, the only difference is you dont inherit a class in public or protected mode, the way to inherit a class is Class Base { protected int length, breadth; public Base(int a, int b) { this.length = a; this.breadth = b; } public virtual int Show() { Console.WriteLine(Length of a rectangle is {0} and breadth is {1}, length, breadth); } } Class Derived: Base // The way to inherit a class in C# { public Derived(int l, int b, string color): base(l, b) // call Base constructor { this.color = color; } // an overridden method beacuse in the derived method we can // change the behaviour, This is a kind on polymorphism. public override int Show() { base.Show(); Console.WriteLine("Color of the rectangle is " color); } public string color; } Class Tester { public static void Main() { Base b = new Base(10, 20); Derived d = new Derived(30, 40, "Red" ); b.Show(); d.show(); } }Output: Length of a rectangle is 10 and breadth is 20 Length of a rectangle is 30 and breadth is 40 Color of the rectangle is RedI hope this will make you a bit clear about Inheritance and polymorphism.

How to find exceptions in database

If program successfully complie . but program is not run or execute.then give an exception.

How can objects be late bound in .NET?

Instead of using new keyword we can use create object like in this example we are creating object to write in excel sheet through our programexampleImports Excel = Microsoft.Office.Interop.ExcelPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objApp As Object Dim objBook As Object Dim objBooks As Object Dim objSheets As Object Dim objSheet As Object Dim range As Object ' Instantiate Excel and start a new workbook. objApp = CreateObject("Excel.Application") objBooks = objApp.Workbooks objBook = objBooks.Add objSheets = objBook.Worksheets objSheet = objSheets.Item(1) range = objSheet.Range("A1") 'Set the range value. range.Value = "Hello, World!" 'Return control of Excel to the user. objApp.Visible = True objApp.UserControl = TrueEnd Sub

Where we can use DLL made in C#.Net

Supporting .Net, bcoz DLL made in C#.Net semicompiled version. Its not a com object. It is used only in .Net Framework.As it is to be compiled at runtime to byte code.

What Datatypes does the RangeValidator Control support?

String, Integer, Double, Date, Currency

Constructor is the method which is implicitly created when ever a class is instantiated. Why?

Constructors are class methods that are executed when an object of a given type is created. Constructors have the same name as the class, and usually initialize the data members of the new object

Why multiple Inheritance is not possible in C#?

Multiple Inheritance is possible in C++, but its not possible in Java, and C#.

what we are read above those are all we know, but as per my knowledge, in C++ to resolve multiple inheritance we are using "this pointer". But in C# there is no pointer concept. In such way, the architectures using the interface concept. To resolving the ambiguity "this pointer" concept used in c++.

Offcourse it not absolutely correct, but its my idea only. If you are agree with my view then follow it, else leave it.

Why strings are immutable?

1) In VB6.0 and c++ strings are simple array of bytes, but in .Net it is class System.String and is immutable.

2) A string is a sequential collection of Unicode characters, which usually is used to represent text. A String, on the other hand, is a .NET Framework class (System.String) that represents a Unicode string with a sequential collection of System.Char structure.

How to convert ocx into DLL

you cannot convert OCX to dll becoz dll do not have GUI interfaces .IF your ocx does not have GUI and you have convert manuly by cut and paste from OCX to Dll project

What is the main difference between pointer and delegate with examples?

A Delegate in c# allows to pass a method of class to object of other class.

Rules in Deligation:-

1.In order to create a Delegate a Signature(parameter) must match Signature of object.

2.Define all the methods which has the same Signature as Deligate define.

3.Create the deligate object & pass the method as a parameter to Deligate.

4.Now call the encapsulated method using deligated object.

the best example of Deligation modle is ADO.NET Architecture & Event Handling in windows environament.

How do i read the information from web.config file?

string ConStrFromWeb=System.Configuration.ConfigurationSettings.AppSettings["ConStringKey"];

// Here ConStringKey is the key name of connection string in web.config

What is the default Function arguments?

Default function argument is a function argument with a default value. Callers of this function have a choice whether to pass a value for default argument or not. If a function call passes a value for default argument it is used as its value. If a function call does not pass a value the default value specified in the function definition is used.

A function may have any number of default arguments. However all these arguments must follow all mandatory arguments. That is first you have to specify all non-default or mandatory parameters and then all default parameters.

What is XML Schema?

Document Type Declaration(DTD)

determines the name of the root element and contains the document type declarations

Elements

Elements are the main building blocks of both XML and HTML documents.

Examples of HTML elements are "body" and "table". Examples of XML elements could be "note" and "message". Elements can contain text, other elements, or be empty. Examples of empty HTML elements are "hr", "br" and "img".

Examples:

body text in between

some message in between

-----------

Attributes

Attributes provide extra information about elements.

Attributes are always placed inside the starting tag of an element. Attributes always come in name/value pairs. The following "img" element has additional information about a source file:

The name of the element is "img". The name of the attribute is "src". The value of the attribute is "computer.gif". Since the element itself is empty it is closed by a " /".

-----------

Entities

Entities are variables used to define common text. Entity references are references to entities.

Most of you will know the HTML entity reference: " ". This "no-breaking-space" entity is used in HTML to insert an extra space in a document. Entities are expanded when a document is parsed by an XML parser.

The following entities are predefined in XML:

Entity References Character

< <

> >

& &

" "

' '

How can i check whether a dataset is empty or not in C#.net

HasRows property is only for DataReader objects. For DataSet you can check whether it has a DataTable or not .. since the DataSet is a collection of DataTable you can check whether it has loaded a table or not using the following code

DataSet dt=new DataSet();

if (dt.Tables.Count>0) // has tables in it

{

}

else // otherwise it is empty

{

}

Is it possible to inherit a class that has only private constructor?

No.

ex.

Base Class:

/// Summary description for BaseA.

///

public class BaseA

{

private BaseA()

{

//

// TODO: Add constructor logic here

//

}

}

Dervied Class:

///

/// Summary description for Class1.

///

public class DerviedB: BaseA

{

public DerviedB()

{

//

// TODO: Add constructor logic here

//

}

}

Result: DerviedB.cs(10): 'PrivateAssembly.BaseA.BaseA()' is inaccessible due to its protection level

How do you choose 1 entry point when C# project has more Main( ) method?

In one .cs file there may be many classes having Main() method. While making the .exe you can define the class name as an entry point

CSC /main:classname filename.cs

The compiler throws an error if XML comments is not well formed

If the XML is not well-formed, a warning is generated and the documentation file will contain a comment saying that an error was encountered.

By declaring a base class function as virtual we allow the function to be overridden in subclasses

The derived class can provide new functionality by overriding the virtual method of the base class.

The method to be called is determined at the run-time depending on the type of the object calling the method, and it does not depend on the type of the variable declared to hold the object. The following example illustrates this point:

Suppose base class B and derived class D provide different implementations of a virtual method V(). Also suppose that there is a non-virtual method NV() of B which is overriden by D.

//In Main(), an object, obj, is declared to be of type B.

B obj;

//An object of D is created for initializing obj

obj = new D;

//Call virtual and non-virtual methods on obj:

obj.V(); //This call would execute D::F() since F() is virtual, and although obj is declared to be of type B, it contains object of type D.

obj.NV(); //This call would execute B::F(), looking at the declaration of obj.

This is the difference between virtual and plain overridable methods. Virtual methods execute slower than non-virtual ones because of run-time resolve of the method to be called. So programmer should be caeful while declaring a method as virtual.

Which of the following can not be declared as virtual

Both A and B are correct choices. Declaring a static function as virtual generates build error. Same with declaring member fields as virtual.

A static function can be called only using class_name.static_function_name() syntax, so there is no run-time resolve depending on the type of object, hence the term virtual does not make a sense in case of static functions.

In case member fields are overriden by a derived class the derived class methods will use the overriden variables by default, so there is no run-time resolve required for fields.

Sealed class can be inherited

sealed classes cannot be inherited as the sealed classes provides full functionality only the classes that have no full functionality can be inherited

Which of the following statements is not true for interfaces

Interfaces must always be declared as public so that they can be implemented or inherited

It is not permitted to declare modifier on the members in an interface definition

A is the correct answer. By default all the members in an Interface definition are public, so there is no need to declare access modifier public. It would be a compile time error otherwise

Interface members can not be declared as

Virtual keyword is meaningful when the derived class is expected to override base class method. Here a class will 'implement' a method of an interface, hence virtual is not meaningful for interface methods.

Static keyword indicates that a method or field is common to all instances of a class. For an interface there will not be any instance, hence static is not meaningful.

An interface and all its methods must be declared public for enabling classes to implement them.

Which method is implicitly called when an object is created

When an object is created Constructor is get called first. A default constructor is created automatically if we do not create a constructor inside a class.

Which of the following statement is invalid with regards to constructor

Constructors should have the same name as class name

Constructors have to be public so that class can be instantiated

Constructors can not be overloaded

Constructors can not be static

C# supports two types of constructor, a class constructor (static constructor) and an instance constructor (non-static constructor).

Static constructor is used to initialize static data members as soon as the class is referenced

first time, whereas an instance constructor is used to create an instance of that class with

keyword. A static constructor does not take access modifiers or have parameters and can't access any non-static data member of a class.

Since static constructor is a class constructor, they are guaranteed to be called as soon as we refer to that class or by creating an instance of that class.

It is not possible for a delegate to wrap more than 1 methods

False

In some cases you may want to call not just one, but two or more methods through a single delegate. This is known as multicasting. You accomplish multicasting by encapsulating the various methods in delegates, and then you combine the delegates using the Delegate.Combine shared method. The Combine method takes an array of delegates as a parameter and returns a new delegate that represents the combination of all the delegates in the array.

In C# events are actually a special form of delegates

False

Events are signals generated by an object to indicate occurrence of an action, while delegates are type safe function pointers.

An event is a way for a class to signal state change / an interesting action. Delegates are reference types which are used to encapsulate methods with a specific signature.

Events are declared using delegates. Objects which want to take some action on occurrence of the event attach their methods to the event handler, which is a delegate.

Which preprocessor directive are used to mark that contain block of code is to be treated as a single block

#Region and #EndRegion indicates a block of code which can be expanded / collapsed.

How are the attributes specified in C#

They are enclosed with in [].

For performing repeated modification on string which class is preferred?

StringBuilder class is preferred for performing repeated operations on string since its value is mutable. String class represents a text value which is immutable. All operations on string class which appear to be modifying its value actually return the new value.

So for modifying text contents StringBuilder class is preferred.

In order to use stringbuilder in our class we need to refer

We only need to refer System.Text namespace. StringBuilder Class is contained in the System.Text namespace. hence we need to add the following lines in pur code:

using System.Text;

Which of the following is not a member of stringbuilder

Answer is: Dsubstring();

Which method is actually called ultimately when Console.WriteLine( ) is invoked

AppendFormat() method is called.

What happens when you create an arraylist as ArrayList Arr=new ArrayList()

Once it will reach size 16 addding element in the arraylist, it will be automatically double the size.

What is the output of Vectors.RemoveAt(1)

Removes the object at position 1

GetEnumerator( ) of Ienumerable interface returns

GetEnumerator() returns a reference to System.Collections.Ienumerator class which allows a simple iteration over a collection

How do you add objects to hashtable

Actually operator "=" adds an element too.

The following example adds key-value

pair "x"-"value" to Hashatble h:

HashTable h = new HashTable();

h("x") = "value";

If A.equals(B) is true then A.getHashcode & B.getHashCode must always return same hash code

The answer is False because it is given that A.equals(B) returns true i.e. objects are equal and now its hashCode is asked which is always independent of the fact that whether objects are equal or not. So, GetHashCode for both of the objects returns different value.

Ans: False

The assembly class is defined in

System.Reflection

What is the first step to do anything with assembly

Load assembly to running process

How do you load assembly to running process

Assembly class provides the following methods to load an assembly:

Load

LoadFrom

LoadFile

LoadWithPartialName

LoadModule

Assemblies cannot be loaded side by side

This is possible in .net and thats the way DLL hell is said to be eliminated, its clearly evident from the GAC

Application Isolation is assured using

ApplicationDomain

Where does the version dependencies recorded

Inside an assembly’s manifest

How do you refer parent classes in C#

This keyword is used for reffering current object and Base keyword is used for referring parrent class. so ans. is C

Which attribute you generally find on top of main method

[ STAThread ]

How do you make a class not instantiable

Making class as Abstract

In a multilevel hierarchy how are the constructors are called

TopDown

Always a parent class constructor is executed before child class' constructor does .. when u instantiate a child/derived class.

Which utility is used to create resource file

resgen

What is the extension of a resource file

.resx

A shared assembly must have a strong name to uniquely identify the assembly

True

Public policy applies to

Public policies are applied on Shared Assemblies.

Stream object can not be initialized

True

Which of the following has stream as the base class

BufferedStream,MemoryStream and FileStream all these 3 classes are inherited from System.IO.Stream class.

Which class use to Read/Write data to memory

MemoryStream

It is a nonbuffered stream whose encapsulated data is directly accessible in memory(RAM not files on disk).

To Configure .Net for JIT activation what do you do

Actually JIT activation is required for COM+ components which can be done by setting JustInTimeActivation attribute to true (choice A). For .net applications / components JIT comes in by default.

Which method is used by COM+ to ascertain whether class can be pooled

CanBePooled

How do you import Activex component in to .NET

An application called AXImp.exe shipped with .Net SDK is used.

This application does something similar as Tlbimp.exe does for non graphical COM components.

It creates a wrapper component that contains the type information that the .Net runtime can understand.

Net Remoting doesn’t allow creating stateless & stateful Remote objects

False

Windows services created by C# app run only

Windows NT & Above

What is an indexer in C#

Indexer is a special syntax for overloading [] operator for a class. After defining an indexer, array syntaxes can be used for the class objects.

In the following cases which is not function overloading

Same parameter types but different return values.

Function overloading depends on the

1) parameter types

2) number of parameters

3) order of parameters

How to implement multiple inheritence in C#

Multiple inheritence in C# is achived by using Interfaces.

In C# a technique used to stream the data is known as

Serialization

Can static methods be overridable?

No

What is the use of fixed statement

The fixed statement sets a pointer to a managed variable and "pins" that variable during the execution of statement.

Without fixed, pointers to managed variables would be of little use since garbage collection could relocate the variables unpredictably. (In fact, the C# compiler will not allow you to set a pointer to a managed variable except in a fixed statement.)

Eg: Class A { public int i; }

A objA = new A; // A is a .net managed type

fixed(int *pt = &objA.i) // use fixed while using pointers with managed

// variables

{

*pt=45; // in this block use the pointer the way u want

}

What is the order of destructors called in a polymorphism hierarchy

Destructors are called in reverse order of constructors. First destructor of most derived class is called followed by its parent's destructor and so on till the topmost class in the hierarchy.

You don't have control over when the first destructor will be called, since it is determined by the garbage collector. Sometime after the object goes out of scope GC calls the destructor, then its parent's destructor and so on.

When a program terminates definitely all object's destructors are called.

How can you sort the elements of the array in descending order

int[] arr = new int[3];

arr[0] = 4;

arr[1] = 1;

arr[2] = 5;

Array.Sort(arr);

Array.Reverse(arr);

Is it possible to Override Private Virtual methods

No: First of all you cannot declare a method as 'private virtual'.

What does the volatile modifier do

The system always reads the current value of a volatile object at the point it is requested, even if the previous instruction asked for a value from the same object. Also, the value of the object is written immediately on assignment.

The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock statement to serialize access. Using the volatile modifier ensures that one thread retrieves the most up-to-date value written by another thread.

What is the C# equivalent of System.Single

Float 32 bit

e.g. float i = 6.8F; // or 6.8f

By default, a real numeric literal on the right-hand side of the assignment operator is treated as double. Therefore, to initialize a float variable use the suffix f or F.

If you don't use the suffix in the previous declaration, you will get a compilation error because you are attempting to store a double value into a float variable.

A single line comments are implemented by

//

Code running under the control of CLR is often referred as

Managed Code

Platform specific code is obtained when

MSIL code is the intermediate code which is platform independent.

When MSIL is compiled actual platform dependent code is generated.

Intermediate Language also facilitates language interoperability

True

NET interfaces are not derived from IUnknown & they do not have associated GUID’s

True

Code written in C# can not used in which of the languages

Java

It is not possible to debug the classes written in other .Net languages in a C# project.

False: It is definitely possible to debug other .Net languages code in a C# project. As everyone knows .net can com



courtesy: http://www.crackthecampus.com