About Me

Hello there! Before talking about qualifications and professional abilities, I would like to introduce myself. I am a Yuvraj Basnet and professional software developer and have been working in this field for 3 long years. I have finished my graduation from The University of Delhi on Computer Science Engineering I considered myself a reasonably experienced programmer with a particular interest in the human side of software development, computers are fascinating machine, but they're mostly reflection of the people using them. In the art of software development, studying code isn't enough; you have to study the people behind the software, too.

Advanced Level Interview Questions and Answers

Advanced Level Interview Questions and Answers

Advanced Level Interview Questions and Answers

Hi there! In the previous article we discussed some important Intermediate level Q&A now in this article we will discuss some important Advanced Level Interview Questions and Answers which is asked by the interviewer at the time of interview.
So, let's get started

Question 1. Explain #Pragma Directive?

Answer- This directive is a special directive used to turn on or off some quality. This type of directives are compiler-specific i.e., they changes from compiler to compiler. 

  •  #pragma startup and #pragma exit: 


These directives helps us to define the functions that are needed to run before program executes( before the control passes to main function) and just before program exit (just before the control returns from main function).

  • #pragma warn Directive: 
#pragma warn directive is used to hide the warning messages which are displayed during compilation. This may be useful for us when we have a large program and we want to solve all the errors before looking on warnings then by using it we can focus on errors by hiding all warnings. we can again let the warnings be visible by making slight changes in syntax.


#pragma warn +xxx (To show the warning)
#pragma warn -xxx (To hide the warning)
#pragma warn .xxx (To toggle between hide and show)

Question 2. Difference between Macros and Functions?

Answer- 
i. It is not compiled, it is pre-processed whereas It is not pre-processed but it is compiled.

ii. Macros do not check for compilation error which leads to unexpected output whereas Function checks for compilation error and there is a less chance of unexpected output.

iii. Code length is increased whereas Code length remains same.

vi. Macros are faster in execution than function whereas Functions are bit slower in execution.

v. Before compilation process the macro name is replaced by the macro value whereas In a function call, transfer of control takes place.

vi. Macros are useful when a small piece of code used multiple times in a program whereas Functions are helpful when a large piece of code repeated number of times.

Question 3. How to avoid the limitation of scanf()?

Answer- 
i. scanf() cannot work with the string of characters.
ii. We cannot enter multiword string into a single variable using scanf().
iii. To avoid this the gets() is used.

Question 4. Explain Round Robin Algorithm? some advantages and disadvantages

Answer -  Round Robin is a CPU scheduling algorithm where each process is assigned a fixed time slot in a cyclic way.

i. It is simple, easy to implement as all processes get fair share of CPU.
2.One of the most commonly used technique in CPU scheduling as a core.
3.It is preemptive as processes are assigned CPU only for a fixed slice of time at most.

Advantages:
i. There is fairness since every process gets equal share of CPU.
ii. The newly created process is added to end of ready queue.
iii. A round-robin scheduler generally employs time-sharing, giving each job a time slot or quantum.
iv. While performing a round-robin scheduling,a particular time quantum is allocated to different jobs.
v. Each process get a chance to reschedule after a particular quantum time in this scheduling.

Disadvantages:
i. There is Larger waiting time and Response time.
ii. There is Low throughput.
iii. There is Context Switches.
iv. Gantt chart seems to come too big (if quantum time is less for scheduling.For Example:1 ms for big scheduling.)
v. Time consuming scheduling for small quantums.

Question 5. Suppose a global variable and local variable have the same name. It is being possible to access a global variable from a block where local variables are defined?

Answer- No, It is not possible in C language. It is always the most local variable that gets preference.

Question 6. Explain Bubble Sort Algorithm?

Answer-  The bubble sort algorithm works by repeatedly swapping adjacent elements that are not in order until the whole list of items is in sequence. In this way, items can be seen as bubbling up the list according to their key values.


Advantage:

1. It is the simplest sorting approach.
2. Best case complexity is of O(N) [for optimized approach] while the array is sorted.
3. Using optimized approach, it can detect already sorted array in first pass with time complexity of O(1).
4. Stable sort: does not change the relative order of elements with equal keys.
In-Place sort.

Disadvantage:

1.Bubble sort is comparatively slower algorithm.







 






Post a Comment

0 Comments