## C Program To Print Prime Numbers From 1 To 100

C program to print prime numbers from 1 to 100. If you are looking for C program to find prime numbers, here in this tutorial we will help you to learn how to write a C program for prime numbers.

## C Program to Print Prime Numbers

Learn how to write a C program to print all Prime numbers between 1 to 100. Writing a C program to display prime numbers between two intervals can be done using various techniques but here in this program, we show how to write a C program to print prime numbers from 1 to 100 in a proper way.

### C Program to Print Prime Numbers Source Code

```/* C Program to print prime numbers from 1 to 100 - PrimeNumbers.C */

#include <stdio.h>
#include <stdlib.h>

void main()
{
//variable declaration
int num1, num2, i, j, flag, temp, count = 0;

printf("Enter the value of num1 and num2 \n");
scanf("%d %d", &num1, &num2);
//logic to finding and printing prime numbers from 1 to 100
if (num2 < 2)
{
printf("There are no primes upto %d\n", num2);
exit(0);
}

printf("Prime numbers are \n");
temp = num1;

if ( num1 % 2 == 0)
{
num1++;
}

for (i = num1; i <= num2; i = i + 2)
{
flag = 0;
for (j = 2; j <= i / 2; j++)
{
if ((i % j) == 0)
{
flag = 1;
break;
}
}
if (flag == 0)
{
printf("%d\n", i);
count++;
}
}
printf("Number of primes between %d & %d = %d\n", temp, num2, count);
}```

### C Program to Print Prime Numbers Output

Enter the value of num1 and num2

1

100

Prime numbers are

2     3    5     7    11    13    17    19     23      29

31      37      41      43      47      53      59      61

67      71     73      79      83      89      97

Number of primes between 1 & 100 = 25

## C Program To Find LCM GCD Of Two Numbers

C Program To Find LCM GCD Of Two Numbers. If you are looking for C program to calculate LCM and GCD of two numbers, here in this tutorial we will help you to learn how to write a program to find LCM in C language.

## C Program to Find LCM and GCD

Learn how to write a C program to find LCM. Writing C Program to finding GCD of a number can be done using various techniques but here in this program, we show how to write a C program to find LCM GCD of two numbers in a proper way.

### C Program to Find LCM and GCD of Two Numbers Source Code

```/* C program to find the LCM and GCD of two numbers - LcmGcd.C */

#include <stdio.h>

void main()
{
//variable declaration
int num1, num2, gcd, lcm, remainder, numerator, denominator;

printf("Enter two numbers\n");
scanf("%d %d", &num1, &num2);

//checking for bigger number
if (num1 > num2)
{
numerator = num1;
denominator = num2;
}
else
{
numerator = num2;
denominator = num1;
}

//calculating remainder
remainder = numerator % denominator;

//logic to find gcd and lcm of two numbers
while (remainder != 0)
{
numerator = denominator;
denominator = remainder;
remainder = numerator % denominator;
}

//finding lcm and gcd of two numbers
gcd = denominator;
lcm = num1 * num2 / gcd;

//printing lcm and gcd of two numbers
printf("GCD of %d and %d = %d\n", num1, num2, gcd);
printf("LCM of %d and %d = %d\n", num1, num2, lcm);
}```

### C Program to Find LCM and GCD of Two Numbers Output

Enter two numbers

65

30

GCD of 65 and 30 = 5

LCM of 65 and 30 = 390

## 581 Advanced Java Interview Questions For 5 8 10 Years Experienced

Advanced Java Interview Questions. Coding compilers collected list of 581 adv java interview questions for freshers to experienced developers.

This list of interview questions includes, java interview questions for experienced professionals, java scenario based interview questions, java interview questions for 3 years experience, java interview questions for 5 years experience, java interview questions for 8 years experience and java j2ee interview questions for 10 years experience.

We are sure that after going through these advanced java interview questions, you will be in a position to handle any java job interview. Happy learning.!

Which Containers Use A Border Layout As Their Default Layout?
Why Do Threads Block On I/o?
How Are Observer And Observable Used?
What Is Synchronization And Why Is It Important?
Can A Lock Be Acquired On A Class?
What’s New With The Stop(), Suspend() And Resume() Methods In Jdk 1.2?
Is Null A Keyword?
What Is The Preferred Size Of A Component?
What Method Is Used To Specify A Container’s Layout?
Which Containers Use A Flowlayout As Their Default Layout?
What State Does A Thread Enter When It Terminates Its Processing?
What Is The Collections Api?
Which Characters May Be Used As The Second Character Of An Identifier, But Not As The First Character Of An Identifier?
What Is The List Interface?
How Does Java Handle Integer Overflows And Underflows?
What Is The Vector Class?
What Modifiers May Be Used With An Inner Class That Is A Member Of An Outer Class?
What Is An Iterator Interface?
What Is The Difference Between The >> And >>> Operators?
Which Method Of The Component Class Is Used To Set The Position And Size Of A Component?
What Is The Difference Between Yielding And Sleeping?
Which Java.util Classes And Interfaces Support Event Handling?
Is Sizeof A Keyword?
What Are Wrapped Classes?
Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?
Can An Object’s Finalize() Method Be Invoked While It Is Reachable?
What Is The Immediate Superclass Of The Applet Class?
What Is The Difference Between Preemptive Scheduling And Time Slicing?
Name Three Component Subclasses That Support Painting.
What Value Does Readline() Return When It Has Reached The End Of A File?

## Java interview questions for experienced professionals

What Is The Immediate Superclass Of The Dialog Class?
What Is Clipping?
What Is A Native Method?
Can A For Statement Loop Indefinitely?
What Are Order Of Precedence And Associativity, And How Are They Used?
When A Thread Blocks On I/o, What State Does It Enter?
To What Value Is A Variable Of The String Type Automatically Initialized?
What Is The Catch Or Declare Rule For Method Declarations?
What Is A Task’s Priority And How Is It Used In Scheduling?
What Class Is The Top Of The Awt Event Hierarchy?
When A Thread Is Created And Started, What Is Its Initial State?
Can An Anonymous Class Be Declared As Implementing An Interface And Extending A Class?
What Is The Immediate Superclass Of Menu?
What Is The Purpose Of Finalization?
Which Class Is The Immediate Superclass Of The Menucomponent Class?
What Invokes A Thread’s Run() Method?
What Is The Difference Between The Boolean & Operator And The && Operator?
Name Three Subclasses Of The Component Class.
What Is The Gregoriancalendar Class?
Which Container Method Is Used To Cause A Container To Be Laid Out And Redisplayed?
What Is The Purpose Of The Runtime Class?
How Many Times May An Object’s Finalize() Method Be Invoked By The Garbage Collector?
What Is The Purpose Of The Finally Clause Of A Try-catch-finally Statement?
What Is The Argument Type Of A Program’s Main() Method?
Which Java Operator Is Right Associative?
Can A Double Value Be Cast To A Byte?
What Must A Class Do To Implement An Interface?
What Method Is Invoked To Cause An Object To Begin Executing As A Separate Thread?
Name Two Subclasses Of The Textcomponent Class.
Which Containers May Have A Menubar?
How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?
What Is The Purpose Of The Wait(), Notify(), And Notifyall() Methods?
What Is An Abstract Method?
How Are Java Source Code Files Named?
What Is The Relationship Between The Canvas Class And The Graphics Class?
What Are The High-level Thread States?
What Value Does Read() Return When It Has Reached The End Of A File?
Can A Byte Object Be Cast To A Double Value?
What Is The Difference Between A Static And A Non-static Inner Class?
What Is The Difference Between The String And Stringbuffer Classes?
If A Variable Is Declared As Private, Where May The Variable Be Accessed?
What Is An Object’s Lock And Which Object’s Have Locks?
What Is The Dictionary Class?
How Are The Elements Of A Borderlayout Organized?
What Is The % Operator?
When Can An Object Reference Be Cast To An Interface Reference?
What Is The Difference Between A Window And A Frame?
Which Class Is Extended By All Other Classes?
Can An Object Be Garbage Collected While It Is Still Reachable?
Is The Ternary Operator Written X : Y ? Z Or X ? Y : Z ?
What Is The Difference Between The Font And Fontmetrics Classes?
How Is Rounding Performed Under Integer Division?
What Happens When A Thread Cannot Acquire A Lock On An Object?
What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?
What Classes Of Exceptions May Be Caught By A Catch Clause?
If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?
What Is The Simpletimezone Class?
What Is The Map Interface?
Does A Class Inherit The Constructors Of Its Superclass?
For Which Statements Does It Make Sense To Use A Label?
What Is The Purpose Of The System Class?
Which Textcomponent Method Is Used To Set A Textcomponent To The Read-only State?
How Are The Elements Of A Cardlayout Organized?
Is &&= A Valid Java Operator?
Name The Eight Primitive Java Types.
What Is The Relationship Between Clipping And Repainting?
Is “abc” A Primitive Value?
What Is The Relationship Between An Event-listener Interface And An Event-adapter Class?
What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?
What Modifiers May Be Used With An Interface Declaration?
Is A Class A Subclass Of Itself?
What Is The Highest-level Event Class Of The Event-delegation Model?
What Event Results From The Clicking Of A Button?
How Can A Gui Component Handle Its Own Events?
How Are The Elements Of A Gridbaglayout Organized?
What Is The Collection Interface?
What Modifiers Can Be Used With A Local Inner Class?
What Is The Difference Between Static And Non-static Variables?
What Is The Difference Between The Paint() And Repaint() Methods?
What Is The Purpose Of The File Class?
Can An Exception Be Rethrown?
Which Math Method Is Used To Calculate The Absolute Value Of A Number?
How Does Multithreading Take Place On A Computer With A Single Cpu?
When Does The Compiler Supply A Default Constructor For A Class?
When Is The Finally Clause Of A Try-catch-finally Statement Executed?
Which Class Is The Immediate Superclass Of The Container Class?
If A Method Is Declared As Protected, Where May The Method Be Accessed?
How Can The Checkbox Class Be Used To Create A Radio Button?
Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?
What Happens When You Invoke A Thread’s Interrupt Method While It Is Sleeping Or Waiting?
What Is Casting?
What Is The Return Type Of A Program’s Main() Method?
Name Four Container Classes.
What Is The Difference Between A Choice And A List?
What Class Of Exceptions Are Generated By The Java Run-time System?
What Class Allows You To Read Objects Directly From A Stream?
What Is The Difference Between A Field Variable And A Local Variable?
Under What Conditions Is An Object’s Finalize() Method Invoked By The Garbage Collector?
What Is The Relationship Between A Method’s Throws Clause And The Exceptions That Can Be Thrown During The Method’s Execution?
What Is The Difference Between The Jdk 1.02 Event Model And The Event-delegation Model Introduced With Jdk 1.1?
How Is It Possible For Two String Objects With Identical Values Not To Be Equal Under The == Operator?
Why Are The Methods Of The Math Class Static?
What Checkbox Method Allows You To Tell If A Checkbox Is Checked?
What State Is A Thread In When It Is Executing?
What Are The Legal Operands Of The Instanceof Operator?
What An I/o Filter?
If An Object Is Garbage Collected, Can It Become Reachable Again?

### Java scenario based interview questions

What Is The Set Interface?
What Classes Of Exceptions May Be Thrown By A Throw Statement?
What Are E And Pi?
Are True And False Keywords?
What Is A Void Return Type?
What Is The Purpose Of The Enableevents() Method?
What Is The Difference Between The File And Randomaccessfile Classes?
What Happens When You Add A Double Value To A String?
What Is Your Platform’s Default Character Encoding?
Which Package Is Always Imported By Default?
What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?
How Are This And Super Used?
What Is A Compilation Unit?
What Interface Is Extended By Awt Event Listeners?
What Restrictions Are Placed On Method Overriding?
What Happens If An Exception Is Not Caught?
What Is A Layout Manager?
Which Arithmetic Operations Can Result In The Throwing Of An Arithmeticexception?
What Are Three Ways In Which A Thread Can Enter The Waiting State?
Can An Abstract Class Be Final?
What Is The Resourcebundle Class?
What Happens If A Try-catch-finally Statement Does Not Have A Catch Clause To Handle An Exception That Is Thrown Within The Body Of The Try Statement?
What Is Numeric Promotion?
What Is The Difference Between A Scrollbar And A Scrollpane?
What Is The Difference Between A Public And A Non-public Class?
To What Value Is A Variable Of The Boolean Type Automatically Initialized?
Can Try Statements Be Nested?
What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator?
What Is The Purpose Of A Statement Block?
What Is A Java Package And How Is It Used?
What Modifiers May Be Used With A Top-level Class?
What Are The Object And Class Classes Used For?
How Does A Try Statement Determine Which Catch Clause Should Be Used To Handle An Exception?
Can An Unreachable Object Become Reachable Again?
When Is An Object Subject To Garbage Collection?
What Method Must Be Implemented By All Threads?
What Methods Are Used To Get And Set The Text Label Displayed By A Button Object?
Which Component Subclass Is Used For Drawing And Painting?
What Are Synchronized Methods And Synchronized Statements?
What Are The Two Basic Ways In Which Classes That Can Be Run As Threads May Be Defined?
What Are The Problems Faced By Java Programmers Who Don’t Use Layout Managers?
What’s Java Swing?
What Is Jfc?
What Is Awt?
What Are The Differences Between Swing And Awt?
What Are Heavy Weight Components ?
What Is Lightweight Component?
What Is Double Buffering ?
What Is An Event In Swing?
What Is An Event Handler In Swing?
Give Us The Name Of The List Layoutmanagers In Java?
Difference B/w Paint() And Paintcomponent()?
What Is The Relationship B/w The Canvas Class And The Graphics Class?
When Should The Method Invokelater() Be Used?
What Is A Convertor?
What Is The Difference Between Jfc & Wfc?
What Is Struts?
How Is The Mvc Design Pattern Used In Struts Framework?
Who Makes The Struts?
Why It Called Struts?
Do We Need To Pay The Struts If Being Used In Commercial Purpose?
What Are The Core Classes Of Struts?
What Is The Design Role Played By Struts?
How Struts Control Data Flow?
What Configuration Files Are Used In Struts?
What Helpers In The Form Of Jsp Pages Are Provided In Struts Framework?
Is Struts Efficient?
How You Will Enable Front-end Validation Based On The Xml In Validation.xml?
What Is Actionservlet?
How You Will Make Available Any Message Resources Definitions File To The Struts Framework Environment?
What Is Action Class?
Write Code Of Any Action Class?
What Is Actionform?

### Java interview questions for 3 years experience

What Is Struts Validator Framework?
Give The Details Of Xml Files Used In Validator Framework?
Why Do We Need Struts?
How Does Struts Work?
Is Struts Compatible With Other Java Technologies?
Who Wrote Struts?
Why Is It Called Struts?
Do I Have To Credit Struts On My Own Website?
Where Can I Get A Copy Of Struts?
How Do I Install Struts?
When Do I Need “struts.jar” On My Classpath?
Does Struts Include Its Own Unit Tests?
If The Framework Doesn’t Do What I Want, Can I Request That A Feature Be Added?
Where Can I Get Help With Struts?
What’s The Difference Between Struts And Turbine? What’s The Difference Between Struts And Espresso?
Why Aren’t The Struts Tags Maintained As Part Of The Jakarta Taglibs Project ?
Are The Struts Tags Xhtml Compliant ?
Will The Struts Tags Support Other Markup Languages Such As Wml ?
What About Jstl And Javaserver Faces ?
Is There A Particularly Good Ide To Use With Struts?
Why Was Reload Removed From Struts (since 1.1)?
What Is A Modular Application? What Does Module-relative Mean?
Why Are Some Of The Class And Element Names Counter-intuitive?
Why Is Actionform A Base Class Rather Than An Interface?
Do Actionforms Have To Be True Javabeans?
Can I Use Multiple Html Form Elements With The Same Name?
Why Doesn’t The Focus Feature On The Tag Work In Every Circumstance?
Why Are My Checkboxes Not Being Set From On To Off?
Can’t I Just Create Some Of My Javabeans In The Jsp Using A Scriptlet?
Can I Use Javascript To Submit A Form?
How Can I Scroll Through List Of Pages Like The Search Results In Google?
Why Do The Struts Tags Provide For So Little Formatting?
Why Does The Tag Url-encode Javascript And Mailto Links?
Why Does The Option Tag Render Selected=selected Instead Of Just Selected?
Do I Have To Use Jsps With My Application?
Can I Have An Action Without A Form?
Can You Give Me A Simple Example Of Using The Requiredif Validator Rule?
When Is The Best Time To Validate Input?
How Can I Avoid Validating A Form Before Data Is Entered?
Declarative Exception Handling
What Is Hibernate?
What Is Orm?
What Does An Orm Solution Comprises Of?
What Are The Different Levels Of Orm Quality?
What Is A Pure Relational Orm?
What Is A Meant By Light Object Mapping?
What Is A Meant By Medium Object Mapping?
What Is Meant By Full Object Mapping?
What Are The Benefits Of Orm And Hibernate?
How Does Hibernate Code Looks Like?
What Is A Hibernate Xml Mapping Document And How Does It Look Like?
What The Core Interfaces Are Of Hibernate Framework?
What Are Callback Interfaces?
What Are Extension Interfaces?
What Are The Extension Interfaces That Are There In Hibernate?
What Are Different Environments To Configure Hibernate?
What Is The File Extension You Use For Hibernate Mapping File?
What Do You Create A Sessionfactory?
What Is Meant By Method Chaining?
What Does Hibernate.properties File Consist Of?
What Should Sessionfactory Be Placed So That It Can Be Easily Accessed?
What Are Pojos?
What Is Hql?
What Is Attribute Oriented Programming?
What Are The Different Methods Of Identifying An Object?
What Are The Different Approaches To Represent An Inheritance Hierarchy?
What Are Managed Associations And Hibernate Associations?
Why Do You Need Orm Tool Like Hibernate?
What Are The Main Advantages Of Orm Like Hibernate?
What Are The Core Interfaces Of Hibernate Framework?
What Is A Hibernatetemplate?
What Are The Benefits Of Hibernatetemplate?
What Is Hibernate Proxy?
Explain The Types Of Hibernate Instance States.
What Are Collection Types In Hibernate?
What Is Lazy Initialization In Hibernate?
What Is Lazy Fetching In Hibernate?
What Is The Difference Between Sorted And Ordered Collection In Hibernate?
What Is Hibernate Query Language (hql)?
Explain The General Flow Of Hibernate Communication With Rdbms.
Explain The Role Of Session Interface In Hibernate.
State The Role Of Sessionfactory Interface Plays In Hibernate.
What Is The Difference Between Merge And Update?
What Is The Advantage Of Hibernate Over Jdbc?
Why Hibernate Is Advantageous Over Entity Beans & Jdbc?
Explain The Main Difference Between Entity Beans And Hibernate.
Explain The Difference Between Hibernate And Spring.
How Will You Configure Hibernate?
What Is A Sessionfactory? Is It A Thread-safe Object?
What Is A Session? Can You Share A Session Object Between Different Theads?
What Are The Benefits Of Detached Objects?
What Are The Pros And Cons Of Detached Objects?
How Does Hibernate Distinguish Between Transient (i.e. Newly Instantiated) And Detached Objects?
What Is The Difference Between The Session.get() Method And The Session.load() Method?
What Is The Difference Between The Session.update() Method And The Session.lock() Method?
How Would You Reatach Detached Objects To A Session When The Same Object Has Already Been Loaded Into The Session?
What Are The General Considerations Or Best Practices For Defining Your Hibernate Persistent Classes?
How Will You Communicate Between Two Applets?
How Do You Communicate In Between Applets And Servlets?
What Is An Applet? Should Applets Have Constructors?
How Will You Initialize An Applet?
How To Insert Your Applets Into Frontpage?
In Our Urls And In The Text Of The Buttons We Have Comma. Its Causing An Error. Is There A Way To Change The Delimiting Character For The Menu Arguments?
What Is The Order Of Method Invocation In An Applet?
What Are The Applets Life Cycle Methods? Explain Them?
What Is The Sequence For Calling The Methods By Awt For Applets?
How Do Applets Differ From Applications?
Can We Pass Parameters To An Applet From Html Page To An Applet? How?
How Do We Read Number Information From My Applets Parameters, Given That Applets Getparameter() Method Returns A String?
How Can I Arrange For Different Applets On A Web Page To Communicate With Each Other?
How Do I Select A Url From My Applet And Send The Browser To That Page?
Can Applets On Different Pages Communicate With Each Other?
Which Classes And Interfaces Does Applet Class Consists?
What Is Appletstub Interface?
What Are The Applets Information Methods?
What Are The Steps Involved In Applet Development?
Which Method Is Used To Output A String To An Applet? Which Function Is This Method Included In?
When Is Update Method Called?

### Java interview questions for 5 years experience

What Is A Message Driven Bean, What Functions Does A Message Driven Bean Have And How Do They Work In Collaboration With Jms?
How Does Concurrency Work For Message-driven Beans?
What Is The Difference Between Message Driven Beans And Stateless Session Beans?
What Is Message Driven Beam?
What Is Session Bean. What Are The Various Types Of Session Bean?
What Is The Difference Between Stateful Session Bean And Stateless Session Bean
What Are The Call Back Methods In Session Bean?
When You Will Chose Stateful Session Bean And Stateless Session Bean
What Is The Relationship Between Enterprise Javabeans And Javabeans?
How To Implement A Bound Property In Your Bean Application?
How And When Will The Javabeans Migration Assistant To Activex Be Available?
Why Would A Developer Need The Javabeans Migration Assistant For Activex?
Can Javabeans Use Dcom As Its Network Model?
Can Both Java Applets And Javabeans Components Use The Infobus?
Javabeans Has Mechanisms Like Bound Properties For Data Transfer Between Components. Why Is The Infobus Necessary?
Is Infobus Easy To Use?
Does The Infobus Compete With Javabeans?
What Is The Infobus?
What Are/is Enterprise Javabeans?
Who Is Developing The Javabeans Migration Assistant To Activex?
Why Is The Javabeans Bridge For Activex Only Available On Windows/x86?
What Is The Relation Between The Infobus And Rmi?
Difference Between Java Beans And Enterprise Java Beans?
Is The Infobus Client Side Only?
How Does The Infobus Relate To Javabeans?
What Is Glasgow?
How To Create Bound Property In Bean Application?
What Is The Serializable Class In Java Beans?
How To Control Serialization In Java Beans?
What Is Introspection Properties In Java Beans?
What Are Introspection Api In Java Beans?
What Is Bean Customization?
What Is Ejb Container?
What Is Ejb Context?
What Is Ejb Home Object?
What Is Ejb Object?
What Is Entity Bean?
What Is Ejb Server?
What Is Enterprise Information System?
What Is Enterprise Javabeans?
What Is Enterprise Javabeans Query Language?
What Is Enterprise Bean Provider?
What Is An Entity?
What Is Entity Reference?
Why Do I Get A Duplicate Name Error When Loading A Jar File?
What Is The Relationship Between Sun S Jfcs And Javabeans?
Are There Javabeans Components Available That I Can Buy Today?
What Kind Of Industry Support Exists For Javabeans?
Why A Component Architecture For The Java Platform?
Is Javabeans A Complete Component Architecture?
Why Are Component Architectures Useful?
What Is A Bean? Why Is Not A Bean An Applet?
Difference Between Java Bean And Bean?
Write A Simple Bean Program?
What Is Property Editor In Java Beans?
What Are The Purpose Of Introspection?
What Are Externizable Interface?
What Is Bean Persistance Property?
Why Do I Get A Nullpointerexception When Loading A Jar File Into The Beanbox?
What Are Java Beans?
What Are The Different Kinds Of Enterprise Beans?
What Are The Methods Of Entity Bean?what Is The Difference Between Container-managed Persistent (cmp) Bean And Bean-managed Persistent(bmp) ?
What Is Software Architecture Of Ejb?
Can Entity Beans Have No Create() Methods?
What Is Bean Managed Transaction?
What Are Transaction Attributes?
What Are Transaction Isolation Levels In Ejb?
How Ejb Invocation Happens?
Is It Possible To Share An Httpsession Between A Jsp And Ejb? What Happens When I Change A Value In The Httpsession From Inside An Ejb?
The Ejb Container Implements The Ejbhome And Ejbobject Classes. For Every Request From A Unique Client, Does The Container Create A Separate Instance Of The Generated Ejbhome And Ejbobject Classes?
Can The Primary Key In The Entity Bean Be A Java Primitive Type Such As Int?
Can You Control When Passivation Occurs?
What Is The Advantage Of Using Entity Bean For Database Operations, Over Directly Using Jdbc Api To Do Database Operations? When Would I Use One Over The Other?
What Is Ejb Ql?
What Are The Special Design Care That Must Be Taken When You Work With Local Interfaces?
What Happens If Remove( ) Is Never Invoked On A Session Bean?
How Can I Call One Ejb From Inside Of Another Ejb?
What Is An Ejb Context?
What Are The Two Important Tcp Socket Classes?
What Technologies Are Included In J2ee?
What Is The Difference Between Ejb And Java Beans?

### Java interview questions for 8 years experience

What Is Ejb Role In J2ee?
Tell Me Something About Local Interfaces.
What Is Enterprise Javabeans (ejb) Container?
What Is In-memory Replication?
What Is Ripple Effect?
What Is A Clone?
What Are The Types Of Scaling?
What Is A Server Group?
What Is The New Basic Requirement For A Cmp Entity Bean Class In 2.0 From That Of Ejb 1.1?
What’s New In The Ejb 2.0 Specification?
How Can I Access Ejb From Asp?
What Is The Relationship Between Local Interfaces And Container-managed Relationships?
What Is Ejbdoclet?
What Is The Difference Between Session And Entity Beans?
Is It Legal To Have Static Initializer Blocks In Ejb?
What Are Local Interfaces? Describe.
What Is Difference Between Ejb 1.1 And Ejb 2.0?
What Is The Difference Between Ejbcreate() And Ejbpostcreate?
Can I Map More Than One Table In A Cmp?
Is Decorator An Ejb Design Pattern?
What Is The Difference Between Ear, Jar And War File?
What Is Re-entrant. Is Session Beans Reentrant. Is Entity Beans Reentrant?
How Many Ejb Objects Are Created For A Bean?
What Is Deployment Descriptor?
What Are The Call Back Methods In Entity Bean?
What Is Local Interface. How Values Will Be Passed?
What Is Abstract Schema?
What Is The Difference Between Find And Select Methods In Ejb?
How Does A Servlet Communicate With A Jsp Page?
Are Enterprise Beans Allowed To Use Thread.sleep()?
Is It Possible To Specify Multiple Jndi Names When Deploying An Ejb?
Is It Possible To Write Two Ejb’s That Share The Same Remote And Home Interfaces, And Have Different Bean Classes? If So, What Are The Advantages/disadvantages?
Can An Ejb Send Asynchronous Notifications To Its Clients?
Is There A Guarantee Of Uniqueness For Entity Beans?
Can A Class Be It’s Own Event Handler? Explain How To Implement This.
Why Does Jcomponent Have Add() And Remove() Methods But Component Does Not?
How Would You Create A Button With Rounded Edges?
If I Wanted To Use A Solarisui For Just A Jtabbedpane, And The Metal Ui For Everything Else, How Would I Do That?
What Is The Difference Between The ‘font’ And ‘fontmetrics’ Class?
What Class Is At The Top Of The Awt Event Hierarchy?
Explain How To Render An Html Page Using Only Swing.
How Would You Detect A Keypress In A Jcombobox?
Why Should The Implementation Of Any Swing Callback (like A Listener) Execute Quickly?
In What Context Should The Value Of Swing Components Be Updated Directly?
Why Would You Use Swingutilities.invokeandwait Or Swingutilities.invokelater?
If Your Ui Seems To Freeze Periodically, What Might Be A Likely Reason?
Why Won’t The Jvm Terminate When I Close All The Application Windows?
Which Method Is Used For Setting Security In Applets?
What Is Jms?
How Jms Is Different From Rpc?
What Are The Advantages Of Jms?
Are You Aware Of Any Major Jms Products Available In The Market?
What Are The Different Types Of Messages Available In The Jms Api?
What Are The Different Messaging Paradigms Jms Supports?
What Is The Difference Between Topic And Queue?
What Is The Role Of Jms In Enterprise Solution Development?
What Is The Use Of Message Object?
What Is The Basic Difference Between Publish Subscribe Model And P2p Model?
What Is The Use Of Bytesmessage?
What Is The Use Of Streammessage?
What Is The Use Of Textmessage?
What Is The Use Of Objectmessage?
What Is The Use Of Mapmessage?
What Is The Difference Between Bytesmessage And Streammessage??
What Is Point-to-point Messaging?
What Is The Advantage Of Persistent Message Delivery Compared To Nonpersistent Delivery?
Give An Example Of Using The Publish/subscribe Model.
How Is A Java Object Message Delivered To A Non-java Client?
What Is Mdb And What Is The Special Feature Of That?
What Are The Types Of Messaging?
What Are The Core Jms-related Objects Required For Each Jms-enabled Application?
What Is The Use Of Load And Require In Ruby?
What Function Converts All Html Special Symbols To Html Entities In Ruby?
What Is The Log That Has To Seen To Check For An Error In Ruby Rails?
What Is The Scope Of A Local Variable In Ruby?
What Is The Use Of Global Variable \$ In Ruby?
Where Does The Start_tabnav Gets Informations For Tabs Rendering In Ruby Rail?
What Type Messaging Is Provided By Jms?
What Are The Different Parts Of A Jms Message ?
What Is The Role Of The Jms Provider?
What Is The Difference Between Byte Message And Stream Message?
What Is Byte Message ?
What Is Object Message ?
What Is Text Message?
What Is Map Message?
What Is Stream Message ?
What Is The Difference Between Queue And Topic ?
What Is Messaging?
Explain About The Programming Language Ruby?
Explain About Class Libraries In Ruby?
Explain About Garbage Collection Feature Of Ruby?
Explain About The Command Line Options?
Explain About Environment Variables Present In Ruby?
Explain About Class Variable And Global Variable?
How Does Ruby Deal With Extremely Large Numbers?
Explain About Float, Dig And Max?
What Is Jboss?
What Is Jta?
How Can You Start A Jta Transaction From A Servlet Deployed On Jboss ?
Which Component Handles Cluster Communication In Jboss ?
Is It Possible To Put A Jboss Server Instance Into Multiple Cluster At The Same Time ?
What’s Jboss Cache In Short ?
What Do You Know About Seam ?
Does Seam Run On Other Application Servers Besides Jboss ?
What’s Jboss Jbpm ?
Can I Run Seam Outside Of Jboss As?
Can I Run Seam In A J2ee Environment?
Can I Run Seam With Jdk 1.4 And Earlier?
Where Can I Find Seam Examples And Documentation?
Can I Use Ajax With Seam?
Can I Unit Test Seam Applications Without Starting The Application Server?
What’s The Difference Between Hibernate And Ejb 3 ? Don’t You Think Ejb 3 Is Just A Clone Of Hibernate ?
Which Hibernate Object Wraps The Jdbc Connection ?
Ok, Is The Session Factory Thread Safe?
What If You Need To Span Your Transaction Across Multiple Servlet Invocations ?

### Java interview questions for 10 years experience

What Are The Differences Between Ejb 3.0 And Ejb 2.0 ?
What Is The Diffrence Between A Local-tx-datasource And A Xa-datasource? Can You Use Transactions In Both ?
What Do You Need To Set-up A Cluster With Jboss ?
What Optimization Could I Use If The Ejb Container Is The Only Point Of Write Access To The Database ?
Explain The Difference Between Nil And False In Ruby?
Explain The Use Of Global Variable \$ In Ruby?
What Is The Use Of Super In Ruby Rails?
Interpolation Is A Very Important Process In Ruby, Comment?
Describe The Environment Variables Present In Ruby.
Explain The Concepts And Capabilities Of Garbage Collection Feature Of Ruby?
Describe Class Libraries In Ruby?
What Is Rails?
Why Ruby On Rails?
How May Messaging Models Do Jms Provide For And What Are They?
Are We Allowed To Change The Transaction Isolation Property In Middle Of A Transaction?
Should Synchronization Primitives Be Used On Bean Methods?
What Is The Default Transaction Attribute For An Ejb?
Is It Possible To Stop The Execution Of A Method Before Completion In A Sessionbean?
What Do You Understand By The Term Network?
Explain The Generic Term Internet.
What Does Tcp/ip Stand For And What Is Its Use?
What Do You Understand By The Term Client-server Application?
What Are Protocols? What Are They Used For?
What Is The Relationship Between Servers And Ports?
What Is The Applet Client Restriction?
Why Servers Should Be Multithreading? Explain.
Why A Client Should Be Multithreading? Explain.
What Is Chat Area? Explain.
What Are The Applet’s Life Cycle Methods? Explain Them.
Which Classes And Interfaces Does Applet Class Consist?
What Are The Applet’s Information Methods?
How Does Ejb Invocation Happens?
What Is Clustering? What Are The Different Algorithms Used For Clustering?

## 399 Core Java Interview Questions For Experienced

Core Java Interview Questions. Coding compilers collected list of 399 core java interview questions for freshers to experienced developers. This list of interview questions includes, java interview questions for 3 years experience, core java interview questions for senior developers, java interview questions for 2 years experience, java interview questions for 5 years experience. We are sure that after going through these java interview questions, you will be in a position to handle any java job interview. Happy learning.!

## Core Java Interview Questions

What Do You Mean By Platform Independence?

Are Jvm’s Platform Independent?
What Is A Jvm?
What Is The Difference Between A Jdk And A Jvm?
What Is A Pointer And Does Java Support Pointers?
What Is The Base Class Of All Classes?
Does Java Support Multiple Inheritance?
Is Java A Pure Object Oriented Language?
Are Arrays Primitive Data Types?
What Is Difference Between Path And Classpath?
What Are Local Variables?
What Are Instance Variables?
How To Define A Constant Variable In Java?
Should A Main Method Be Compulsorily Declared In All Java Classes?
What Is The Return Type Of The Main Method?
Why Is The Main Method Declared Static?
What Is The Arguement Of Main Method?
Can A Main Method Be Overloaded?
Can A Main Method Be Declared Final?
Does The Order Of Public And Static Declaration Matter In Main Method?
Can A Source File Contain More Than One Class Declaration?
What Is A Package?
Which Package Is Imported By Default?
Can A Class Declared As Private Be Accessed Outside It’s Package?
Can A Class Be Declared As Protected?
What Is The Access Scope Of A Protected Method?
What Is The Purpose Of Declaring A Variable As Final?
What Is The Impact Of Declaring A Method As Final?
I Don’t Want My Class To Be Inherited By Any Other Class. What Should I Do?
Can You Give Few Examples Of Final Classes Defined In Java Api?
How Is Final Different From Finally And Finalize?
Can A Class Be Declared As Static?
When Will You Define A Method As Static?
What Are The Restriction Imposed On A Static Method Or A Static Block Of Code?
I Want To Print “hello” Even Before Main Is Executed. How Will You Acheive That?
What Is The Importance Of Static Variable?
Can We Declare A Static Variable Inside A Method?
What Is An Abstract Class And What Is It’s Purpose?
Can A Abstract Class Be Declared Final?
What Is Use Of A Abstract Variable?
Can You Create An Object Of An Abstract Class?
Can A Abstract Class Be Defined Without Any Abstract Methods?
Class C Implements Interface I Containing Method M1 And M2 Declarations. Class C Has Provided Implementation For Method M2. Can I Create An Object Of Class C?

### Java Interview Questions for 2 Years Experience

Can A Method Inside A Interface Be Declared As Final?
Can An Interface Implement Another Interface?
Can An Interface Extend Another Interface?
Can A Class Extend More Than One Class?
Why Is An Interface Be Able To Extend More Than One Interface But A Class Can’t Extend More Than One Class?
Can An Interface Be Final?
Can A Class Be Defined Inside An Interface?
Can An Interface Be Defined Inside A Class?
What Is A Marker Interface?
If I Only Change The Return Type, Does The Method Become Overloaded?
Can We Define Private And Protected Modifiers For Variables In Interfaces?
What Is Externalizable?
What Modifiers Are Allowed For Methods In An Interface?
What Is A Local, Member And A Class Variable?
What Is An Abstract Method?
What Value Does Read() Return When It Has Reached The End Of A File?
Can A Byte Object Be Cast To A Double Value?
What Is The Difference Between A Static And A Non-static Inner Class?
A non-static inner class may have object instances that are associated with instances of the class’s outer class. A static inner class does not have any object instances.
What Is An Object’s Lock And Which Object’s Have Locks?
What Is The % Operator?
When Can An Object Reference Be Cast To An Interface Reference?
Which Class Is Extended By All Other Classes?
Which Non-unicode Letter Characters May Be Used As The First Character Of An Identifier?
What Is Transient Variable?
What Is Collection Api?
What Is Casting?
What Is The Return Type Of A Program’s Main() Method?
If A Variable Is Declared As Private, Where May The Variable Be Accessed?
What Do You Understand By Private, Protected And Public?
What Is Downcasting ?
What Modifiers May Be Used With An Inner Class That Is A Member Of An Outer Class?
How Many Bits Are Used To Represent Unicode, Ascii, Utf-16, And Utf-8 Characters?
What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?
What Is A Native Method?
What Are Order Of Precedence And Associativity, And How Are They Used?
Can An Anonymous Class Be Declared As Implementing An Interface And Extending A Class?
What Is The Range Of The Char Type?
What Is The Range Of The Short Type?
What Does It Mean That A Method Or Field Is “static”?
Is Null A Keyword?
Which Characters May Be Used As The Second Character Of An Identifier,but Not As The First Character Of An Identifier?
Is The Ternary Operator Written X : Y ? Z Or X ? Y : Z ?
How Is Rounding Performed Under Integer Division?
If A Class Is Declared Without Any Access Modifiers, Where May The Class Be Accessed?
Does A Class Inherit The Constructors Of Its Superclass?
Name The Eight Primitive Java Types.
What Restrictions Are Placed On The Values Of Each Case Of A Switch Statement?
What Is The Difference Between A While Statement And A Do Statement?
What Modifiers Can Be Used With A Local Inner Class?
When Does The Compiler Supply A Default Constructor For A Class?
If A Method Is Declared As Protected, Where May The Method Be Accessed?
What Are The Legal Operands Of The Instanceof Operator?
Are True And False Keywords?
What Happens When You Add A Double Value To A String?
What Is The Diffrence Between Inner Class And Nested Class?
Can An Abstract Class Be Final?
What Is Numeric Promotion?
What Is The Difference Between A Public And A Non-public Class?
To What Value Is A Variable Of The Boolean Type Automatically Initialized?
What Is The Difference Between The Prefix And Postfix Forms Of The ++ Operator?
What Restrictions Are Placed On Method Overriding?
What Is A Java Package And How Is It Used?
What Modifiers May Be Used With A Top-level Class?
What Is The Difference Between An If Statement And A Switch Statement?
Can A Method Be Overloaded Based On Different Return Type But Same Argument Type ?
What Happens To A Static Var That Is Defined Within A Method Of A Class ?
How Many Static Init Can You Have ?
What Is Constructor Chaining And How Is It Achieved In Java ?
What Is The Difference Between The Boolean & Operator And The && Operator?
Which Java Operator Is Right Associative?
Can A Double Value Be Cast To A Byte?

### Java Interview Questions for 3 Years Experience

What Is The Difference Between A Break Statement And A Continue Statement?
Can A For Statement Loop Indefinitely?
To What Value Is A Variable Of The String Type Automatically Initialized?
What Is The Difference Between A Field Variable And A Local Variable?
How Are This() And Super() Used With Constructors?
What Does It Mean That A Class Or Member Is Final?
What Does It Mean That A Method Or Class Is Abstract?
Can An Anonymous Class Be Declared As Implementing An Interface And Extending A Class?
What Is The Catch Or Declare Rule For Method Declarations?
What Are Some Alternatives To Inheritance?
What Are The Different Identifier States Of A Thread?
What Is Garbage Collection? What Is The Process That Is Responsible For Doing That In Java?
How Will You Invoke Any External Process In Java?
What Is The Finalize Method Do?
What Is Mutable Object And Immutable Object?
What Is The Basic Difference Between String And Stringbuffer Object?
What Is The Purpose Of Void Class?
What Is Reflection?
What Is The Base Class For Error And Exception?
What Is The Byte Range?
What Is The Implementation Of Destroy Method In Java.. Is It Native Or Java Code?
What Are The Approaches That You Will Follow For Making A Program Very Efficient?
What Is Locale?
How Will You Load A Specific Locale?
What Is Jit And Its Use?
Is Jvm A Compiler Or An Interpreter?
What Is The Purpose Of Assert Keyword Used In Jdk1.4.x?
How Will You Get The Platform Dependent Values Like Line Separator, Path Separator, Etc., ?
Is “abc” A Primitive Value?
What Is Singleton?
Can You Instantiate The Math Class?
What Are The Methods In Object?
What Is Aggregation?
What Is Composition?
What Is Inner Class?
What Is Nested Class?
What Is The Major Difference Between Linkedlist And Arraylist?
What Is The Significance Of Listiterator?
What Is The Final Keyword Denotes?
What Is Skeleton And Stub? What Is The Purpose Of Those?
Why Does It Take So Much Time To Access An Applet Having Swing Components The First Time?
What Is The Difference Between Instanceof And Isinstance?
What Does The “final” Keyword Mean In Front Of A Variable? A Method? A Class?
Describe What Happens When An Object Is Created In Java?
What Is The Difference Amongst Jvm Spec, Jvm Implementation, Jvm Runtime ?
How Does Java Handle Integer Overflows And Underflows?
Why Are There No Global Variables In Java?
Whats The Difference Between Notify() And Notifyall()?
How Can My Application Get To Know When A Httpsession Is Removed?
What Interface Must An Object Implement Before It Can Be Written To A Stream As An Object?
What Is Your Platform’s Default Character Encoding?
What An I/o Filter?
What Is The Purpose Of Finalization?
What Is The Purpose Of The System Class?
Can We Use The Constructor, Instead Of Init(), To Initialize Servlet?
How Can A Servlet Refresh Automatically If Some New Data Has Entered The Database?

### Java Interview Questions for 4 Years Experience

The Code In A Finally Clause Will Never Fail To Execute, Right?
How Many Messaging Models Do Jms Provide For And What Are They?
What Information Is Needed To Create A Tcp Socket?
How Many Jsp Scripting Elements Are There And What Are They?
What Are Stored Procedures? How Is It Useful?
How Do I Include Static Files Within A Jsp Page?
Why Does Jcomponent Have Add() And Remove() Methods But Component Does Not?
How Can I Implement A Thread-safe Jsp Page?
What Is The Difference Between Procedural And Object-oriented Programs?
What Are Encapsulation, Inheritance And Polymorphism?
What Is The Difference Between Assignment And Initialization?
What Is Oops?
What Are Class, Constructor And Primitive Data Types?
What Is An Object And How Do You Allocate Memory To It?
What Is The Difference Between Constructor And Method?
What Are Methods And How Are They Defined?
What Is The Use Of Bin And Lib In Jdk?
How Many Ways Can An Argument Be Passed To A Subroutine And Explain Them?
What Is The Difference Between An Argument And A Parameter?
How Would You Implement A Thread Pool?
What Are The Advantages And Disadvantages Of Reference Counting In Garbage Collection?
Why Java Is Said To Be Pass-by-value ?
What Are The Access Modifiers Available In Java?
What Is The Difference Between A Switch Statement And An If Statement?
What Are Synchronized Methods And Synchronized Statements?
What Are The Different Ways In Which A Thread Can Enter Into Waiting State?
What Is The Difference Between Static And Non Static Variables ?
What Is The Difference Between Notify And Notifyall Method?
What Are Different Type Of Exceptions In Java?
Explain About The Select Method With An Example?
Can There Be An Abstract Class With No Abstract Methods In It?
Can We Define Private And Protected Modifiers For Variables In Interfaces?
What Is Garbage Collection? What Is The Process That Is Responsible For Doing That In Java?
Can There Be An Abstract Class With No Abstract Methods In It?
Can An Interface Have An Inner Class?
What Is User Defined Exception?
What Is The Difference Between Logical Data Independence And Physical Data Independence?
What Are The Practical Benefits, If Any, Of Importing A Specific Class Rather Than An Entire Package (e.g. Import Java.net.* Versus Import Java.net.socket)?
How Many Methods Do U Implement If Implement The Serializable Interface?
What Does The “abstract” Keyword Mean In Front Of A Method? A Class?
You Can Create A String Object As String Str = “abc”; Why Cant A Button Object Be Created As Button Bt = “abc”;? Explain
Can Rmi And Corba Based Applications Interact ?
What Is Passed By Reference And Pass By Value ?
What Is A “stateless” Protocol ?
Difference Between A Class And An Object ?
What Are The Four Corner Stones Of Oop?
What Gives Java It’s “write Once And Run Anywhere” Nature?
What Happens If An Exception Is Not Caught?
What Is A Compilation Unit?
What Is A Task’s Priority And How Is It Used In Scheduling?
What Value Does Readline() Return When It Has Reached The End Of A File?
Can An Object’s Finalize() Method Be Invoked While It Is Reachable?
Does Garbage Collection Guarantee That A Program Will Not Run Out Of Memory?
Is Sizeof A Keyword?
What State Does A Thread Enter When It Terminates Its Processing?
Can A Lock Be Acquired On A Class?
How Are Observer And Observable Used?
What Is A Transient Variable?
Wha Is The Output From System.out.println(“hello”+null); ?
What Are E And Pi?
If An Object Is Garbage Collected, Can It Become Reachable Again?
Can An Exception Be Rethrown?
What Is The Purpose Of The File Class?
Is A Class Subclass Of Itself?
What Modifiers May Be Used With An Interface Declaration?
What Classes Of Exceptions May Be Caught By A Catch Clause?
What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?
Can An Object Be Garbage Collected While It Is Still Reachable?
What Is An Object’s Lock And Which Object’s Have Locks?
How Are Commas Used In The Intialization And Iteration Parts Of A For Statement?
What Must A Class Do To Implement An Interface?
What Is The Difference Between Preemptive Scheduling And Time Slicing?
What Restrictions Are Placed On The Location Of A Package Statement Within A Source Code File?
What Are Wrapped Classes?
Is It Possible To Specify Multiple Jndi Names When Deploying An Ejb?
What Is Java And Their Uses?
What Is Hotjava?
How Can You Say Java Is Object Oriented?
Why Java Is Platform Independent? Explain.
Why Java Is Secure? Explain.
Why Do People Says “java Is Robust”?
How Java Is Similar To C?
What’s The Difference Between Applets And Standalone Program?
Why Java Applets Are More Useful For Intranets As Compared To Internet?
How Can You Set The Applet Size?
How Can You Set An Applet’s Height And Width As A Percentage?
What Is Codebase?
What Is Appletviewer?
Explain, Java Is Compatible With All Servers But Not All Browsers?
What Is The Program Development Process?
What Is The File Type?
What Is Javac_g?
How To Optimize The Javac Output?
What Is The Difference Between Java Applets And Applications?
Can You Explain The Cs Option Of Java Interpreter?
What Is The Statements?
What Is Style And Indentation?
What Is The Program Compilation Process?
What Is Java Literals?
What Is The Primitive Type Byte?
What Is The Primitive Type Short?
Why Call By Value Prevents Parameter Value Change?
What Is Remote Method Invocation (rmi)?
What Is Java Jit Compilers?
What Is The Java Idl System?
What Is Java Beans?
What Is Object-oriented Programming?
What Is Abstraction?
What Is Encapsulation?
How Does The Application Server Handle The Jms Connection?
What Is A Superclass?
Explain The Abstract Class Modifier?
What Is The Final Class Modifier?
Explain The Public Class Modifier.
What Is The Public Field Modifier?
Explain The Private Field Modifier?
Explain The Protected Field Modifier?
Can You Explain The Private Protected Field Modifier?
What Is The Static Field Modifier?
What Is The Final Field Modifier?
Explain The Transient Field Modifier?
Explain The Use Of Volatile Field Modifier?
What Is Default Constructors?
What Is The Public Method Modifier?
What Is The Private Method Modifier?
What Is The Protected Method Modifier?
Explain The Private Protected Method Modifier?
Can You Explain The Final Method Modifier?
What Is The Abstract Method Modifier?
What Is The Synchronized Method Modifier?
Explain The Init Method?
What Is The Destroy Method?

### Java Interview Questions for 5 Years Experience

How Java Uses The String And Stringbuffer Classes?
What Is The Epoch Date?
What Is An Arrays?
What Is Binary Search?
Can A Private Method Of A Superclass Be Declared Within A Subclass?
What Is Quick Sort?
What Is The Difference Between Final, Finally And Finalize?
In System.out.println( ), What Is System, Out And Println?
What Is Meant By “abstract Interface”?
What Is The Difference Between Swing And Awt Components?
Why Java Does Not Support Pointers?
What Are Parsers? Dom Vs Sax Parser.
What Is A Platform?
What Is The Main Difference Between Java Platform And Other Platforms?
What Is The Java Virtual Machine?
What Is The Java Api?
What Is The Package?
What Is Native Code?
Is Java Code Slower Than Native Code?
What Is The Serialization?
How To Make A Class Or A Bean Serializable?
How Many Methods Are There In The Serializable Interface?
How Many Methods Are There In The Externalizable Interface?
Which Containers Use A Border Layout As Their Default Layout?
What Is Synchronization And Why Is It Important?
What Are Three Ways In Which A Thread Can Enter The Waiting State?
What Is The Preferred Size Of A Component?
Can Java Object Be Locked Down For Exclusive Use By A Given Thread?
Can Each Java Object Keep Track Of All The Threads That Want To Exclusively Access It?
What Is The Purpose Of The Wait(), Notify() And Notifyall() Methods?
What Are The High-level Thread States?
What Is The Collections Api?
What Is The List Interface?
How Many Bits Are Used To Represent Unicode, Ascii, Utf-16 And Utf-8 Characters?
What Is The Properties Class?
What Is The Purpose Of The Runtime Class?
What Is The Purpose Of The Finally Clause Of A Try-catch-finally Statement?
What Is The Locale Class?
What Is A Protected Method?
What Is A Static Method?
What Is The Difference Between A Window And A Frame?
What Are Peerless Components?
What Is The Difference Between The Reader/writer Class Hierarchy And The Inputstream/outputstream Class Hierarchy?
What Is The Difference Between Throw And Throws Keywords?
Name Primitive Java Types?
How Can A Gui Component Handle Its Own Events?
What Are The Problems Faced By Java Programmers Who Don’t Use Layout Managers?
What Is The Difference Between Static And Non-static Variables?
What Is The Difference Between The Paint() And Repaint() Methods?
What Is A Container In A Gui?
Is Iterator A Class Or Interface? What Is Its Use?
How You Can Force The Garbage Collection?
Describe The Principles Of Oops?
Explain The Encapsulation Principle?
Explain The Inheritance Principle?
How To Define An Abstract Class?
How To Define An Interface?
Explain The Polymorphism Principle?
Explain The Different Forms Of Polymorphism?
What Are Access Specifiers Available In Java?
What Do You Understand By A Variable?
What Do You Understand By Numeric Promotion?
Differentiate Between A Class And An Object.
What Is The Use Of Object And Class Classes?
What Do You Understand By Casting In Java Language?
What Are The Types Of Casting?
What Do You Understand By Downcasting?
What Do You Understand By Final Value?
What Are Keyboard Events?
What Is The Intersection And Union Methods?
What Are Controls And Their Different Types In Awt?
What Is The Difference Between Choice And List?
What Is The Difference Between Scrollbar And Scrollpane?
Which Containers Use A Flow Layout As Their Default Layout?
What Are Wrapper Classes?
What Is The Difference Between Set And List?
How Can The Checkbox Class Be Used To Create A Radio Button?
Which Textcomponent Method Is Used To Set A Textcomponent To The Read-only State?
What Methods Are Used To Get And Set The Text Label Displayed By A Button Object?
What Is The Difference Between Yield() And Sleep()?
How To Handle A Web Browser Resize Operation?
Explain The Concept Of Hashtables?

## C Program To Print Hello World

C Program To Print Hello World. If you are looking for writing your first C program to Hello World, here in this tutorial we will help you to learn how to write a program to display Hello World in C language.

## C Program To Print Hellow World

```/* C program to print hello world - HelloWorld.C */

#include <stdio.h>
void main()
{
printf("Hello World.!");
}```

Hello World.!

## C Program To Find Area Of A Circle

C Program To Find Area Of A Circle. If you are looking for C program to calculate area of a circle, here in this tutorial we will help you to learn how to write a program to find area of a circle in C language.

## C Program to Find Area of a Circle

Learn how to write a C program to find area of a circle. Writing C Program to finding area of circle can be done using various techniques but here in this program, we show how to write a C program to calculate area of a circle in a proper way.

### C Program to Calculate Area of a Circle Source Code

```/* C program to calculate area of a circle - AreaOfCircle.C */
#include <stdio.h>
#include <math.h>
#define PI 3.142

void main()
{
//variable declaration
printf("Enter the radius of a circle \n");
//logic to find area of a cirlce
area = PI * pow(radius, 2); //area of a circle formula
//printing area of a cirlce
printf("Area of a circle = %5.2f\n", area);
}```

### C Program to Find Area of a Circle Source Code

```/* C program to find area of a circle - AreaOfCircle.C */

#include<stdio.h>

int main()
{
//variables declaration
//Taking input from user and reading it
printf("\nEnter the radius of Circle : ");
//formula to find area of a circle
//printing area of a circle
printf("\nArea of a Circle is: %f", area);

return (0);
}```

### C Program to Find Area of a Circle Output

Enter the radius of Circle : 15

Area of a Circle is: 706.5

## C Program To Add Spaces In A String

C Program To Add Spaces In A String. If you are looking for C program to add space to a string, here in this tutorial we will help you to learn how to write a C program to add space to a string.

## C Program to Add Spaces in a String

Learn how to write a C program to add spaces in a string. Writing C Program to add space to a string can be done using various techniques but here in this program, we show how to write a C program to adding spaces in a string in a proper way.

### C Program to Add Spaces in a String Source Code

```/* C Program to add spaces in a string - AddSpacesInString.C */
#include <iostream>
//#include <iomanip>
#include <cctype>
#include <string>

using namespace std;

//void fixPuct(string);
void fixPuct(string&);

int main()
{
//char *statement; // don't mix C strings with C++
//statement = new char [60];
cout << "Enter a statement with Caps at start of each new word ..." << endl;
// Enter a statement with Caps at start of each new word ...

string statement; // construct an empty C++ string
if( getline(cin, statement) )
//if (statement != NULL)
{
//cout << "Enter a statement: ";
//cin. getline(statement, 60);// see above re. using C++ strings with C++
//getline( cin statement ); // see above re. using C++ strings with C++
cout << "You entered " << '"' << statement << '"' << endl;

fixPuct(statement);
cout << "Here it is fixed ...\n"
<< statement << endl;
//delete [] statement;
}

cout << "\nPress 'Enter' to continue/exit ... " << flush;
getline( cin, statement );
}

//void fixPuct(string s)
void fixPuct(string& s) // Note: NEED to pass in by reference so calling string gets updated ...
{
int size = s.size();
if(size)
{
string nLine(1, s[0]);
for( int i=1; i<size; i++ )
{
if( isupper(s[i]) )
{
if( i > 0 && !isspace(s[i-1]) ) nLine += ' ';
nLine += tolower(s[i]);
}
else nLine += s[i];
}
s = nLine;
}
}```

### C Program to Add Spaces in a String Output

Enter a statement with Caps at start of each new word …

TheBig BrownBear sat OnTheLittleBlueBox.

Here it is fixed …

The big brown bear sat on the little blue box.

Press ‘Enter’ to continue/exit …

## Top 688 .NET Interview Questions For Experienced

Top 688 .NET Interview Questions For Experienced. .NET technical interview questions for beginners to 5+ years experienced users. This list includes .NET Framework, Assemblies, ASP.NET, C#, ADO.NET, SQL Server, Crystal Reports, Ajax, Javascript, Triggers, WCF, WPF, Silverlight, Visual Studio and related topics.

## .NET Interview Questions

1. What Is The Microsoft.net?
2. What Is The .net Framework?
3. What Is Clr?
4. What Is Cts?
5. What Is Cls?
6. What Is Managed Code?
7. What Is Msil?
8. What Is Jit?
9. What Is Portable Executable (pe)?
10. What Is An Application Domain?
11. How Does An Appdomain Get Created?
12. What Is An Assembly?
13. What Are The Contents Of Assembly?
14. What Are The Different Types Of Assembly?
15. What Is A Dynamic Assembly?
16. What Is A Strong Name?
17. What Is Gac? What Are The Steps To Create An Assembly And Add It To The Gac?
18. What Is The Caspol.exe Tool Used For?
19. What Is A Garbage Collector?
20. What Are Generations And How Are They Used By The Garbage Collector?
21. What Is Ilasm.exe Used For?
22. What Is Ildasm.exe Used For?
23. What Is The Resgen.exe Tool Used For?
24. What Is Boxing And Unboxing?
25. How Can We Make A Thread Sleep For Infinite Period ?
26. In Which Format You Can Pass The Value In The Sleep Function?
28. How Can You Reference Current Thread Of The Method ?
29. What Does Addressof Operator Do In Background ?
30. Different Levels Of Priority Provided By .net.
31. Is There Any Thread In Our .net Programs?
32. Namespace For The Thread Class?
33. Can We Have Multiple Threads In One App Domain ?
34. Did Vb6 Support Multi-threading ?
35. What Is A Thread ?
38. What Is Equivalent For Regsvr32 Exe In .net ?
39. How Do We Create Dcom Object In Vb6?
40. Can You Explain What Is Dcom ?
41. What Is Satellite Assembly? And Steps To Create Satellite Assembly?
42. How To Exclude A Property From Xml Serialization?
43. What Is Garbage Collector ?
44. What Is Difference Between Code Access And Role Based Security?
45. What Is Cas?
46. Can We Customize The Serialization Process?
47. Types Of Serialization
48. What Is Serialization?
49. What Is Namespace?
50. What Is Gac? How To Put Assembly In Gac?
51. What Is An Assembly Loader?
52. What Is An Assembly Qualified Name
53. What Is Partial Assembly Reference
54. What Is Full Assembly Reference
55. What Are The Contents Of An Assembly ?
56. What Are The Types Of Assembly Available
57. What Are Attributes?
58. What Is Manifest?
59. What Is Jit Compiler
60. What Debugging Tools Come With The .net Sdk?
61. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
62. What Is Cls
63. What Is Clr
64. What Is Dependency Injection?
65. Can You Describe Iuknown Interface In Short?
66. What Is Reference Counting In Com?
67. What Is Com?
68. When We Use Windows Api In .net Is It Managed Or Unmanaged Code?
69. Once I Have Developed The Com Wrapper Do I Have To Still Register The Com In Registry?
70. In Which Order The Destructor Is Called For An Inherited Class?
71. In Which Order The Constructor Is Called For An Inherited Class?
72. What Are Value Types And Reference Types ?
73. What Is The Difference Between Viewstate And Sessionstate?
74. Difference Between Machine.config And Web.config?
75. How Is .net Able To Support Multiple Languages?
76. What Is View State?
77. Can The Validation Be Done In The Server Side? Or This Can Be Done Only In The Client Side?
78. How To Manage Pagination In A Page?
80. How To Get The Sum Of Last 3 Items In A List Using Lambda Expressions?
81. You Have Got 1 Million Parking Slots. At A Time A Parking Slot Can Be Free Or Not. To Get Next Slot Easily Which Data Structure To Implement?
82. Why Can’t Struct Be Used Instead Of Class For Storing Entity?
83. What Is Assembly Version Series Sequence?
84. What Tool We Have To Use To Install Assembli In Gac Folder.
85. Ho We Can See Assembly Information?
86. What Is Private And Shared Assembly?
87. What Is Type Safety?
89. What Is Func In .net 3.5?
90. What Is Action In C# 3.5?
91. What Is The Advantage Of Mvc?
92. Advantages Of Vb.net And C#
93. What Is Garbage Collection?
94. How Many Types Of Stored Procedures Are There In Sql Server?
95. What Is The Purpose Of Linked Server Configuration In Sql Server?
96. What Is Difference Between Tostring() Vs Convert.tostring() Vs (string) Cast
97. In How Many Ways You Can Invoke Ssrs Reports?
98. What Is A Static Constructor?
99. Why Do I Get Errors When I Try To Serialize A Hashtable?
100. Why Is Xmlserializer So Slow?

### .NET Technical Interview Questions

1. Can I Customise The Serialization Process?
2. Does The .net Framework Have In-built Support For Serialization?
3. Is The Lack Of Deterministic Destruction In .net A Problem?
4. Why Doesn’t The .net Runtime Offer Deterministic Destruction?
5. How Does Assembly Versioning Work?
6. How Do Assemblies Find Each Other?
7. Where Is The Output Of Textwritertracelistener Redirected?
8. Why Are There Five Tracing Levels In System.diagnostics.traceswitcher?
9. What’s The Difference Between The Debug Class And Trace Class?
10. What Does Assert() Method Do?
11. Why String Are Called Immutable Data Type ?
12. What Is Side-by-side Execution? Can Two Application One Using Private Assembly And Other Using Shared Assembly Be Stated As A Side-by-side Executables?
13. Changes To Which Portion Of Version Number Indicates An Incompatible Change?
14. What Is Partial Assembly References?
15. What Is The Difference Between Finalize And Dispose (garbage Collection) ?
16. What Is Reflection?
17. What Does ‘managed’ Mean In The .net Context?
18. What Platforms Does The .net Framework Run On?
19. When Was The First Version Of .net Released?
20. When Was .net Announced?
21. What Is .net Remoting?
22. How Do You Generate A Strong Name?
23. What Is The Gac? What Problem Does It Solve?
24. What Is Strong-typing Versus Weak-typing? Which Is Preferred? Why?
25. What Is The Difference Between An Exe And A Dll?
26. Describe The Advantages Of Writing A Managed Code Application Instead Of Unmanaged One. What’s Involved In Certain Piece Of Code Being Managed?
27. What Is Public Or Shared Assemblies ?
29. What Are The Mobile Devices Supported By .net Platform
30. Can You Declare The Override Method Static While The Original Method Is Non-static?
31. What Is Boxing And Unboxing ?
32. What Is Msil, Il, Cts And, Clr ?
33. What Is Gc (garbage Collection) And How It Works
34. How Do I Unload An Application Domain?
35. How Do I Unload An Assembly?
36. How Do I Run Managed Code In A Process?
37. What Is The Difference Between An Application Domain And A Process?
38. What Is A Clr Host?
39. Can We Maintain State In Webservice?
40. Difference Between Authentication And Authorization?
41. What Is The Purpose Of Enumerable Class In .net?
42. In The Page Load Event I Assigned Dropdownlist’s Datasource Property To A Valid List. On The Submit Button Click.. The Same Datasource Property Is Coming As Null. Why?
44. What Is Replication?
45. What Are The Different Types Of Remote Object Creation Mode In .net?
46. What Is Application Domain?
50. What Is Dcom?
51. How To Install Or Uninstall A Windows Service?
52. What Is Jit? What Are The Different Types Of Jit?
53. What Is Delay Signing?
54. What Is Strong Name?
55. What Is Code Verification?
56. What Is Code Access Security?
57. What Is Il?
58. What Is Class Library In .net
59. How To Block A Class From Being Inherited Further?
60. How To Find The Current Application File Path While Runtime?
61. What Is The Base Class Of All Classes In C#?
62. You Are Designing A User Control. You Created New Property Called Backgroundimage Which Is Of Type Image. You Wanted To Disable Storing This Property In The User’s Form. How To Achieve This?
63. You Are Creating A Custom Usercontrol, Some Of The Newly Created Properties Are Shown In The Properties Window. How You Can Hide A New Property Named Theme From The Properties Window?
64. How To Sort An Int Array In C#?
65. How To Prevent The Error While Updating Ui Control From Another Thread?
66. You Are Designing A Single Person Shooter Game Application. The Player Can Choose Between Multiple Guns. 1) Pistol With 5 Bullets 2) Shotgun With 100 Bullets 3) Grenade Launcher With 20 Grenades Each Gun Will Have Different Sound Effects And Graphics.pressing Ctrl+space Should Rotate Between Guns.which Design Pattern Should You Employ For This?
67. How To Find Whether The Application Is Run From Inside Ide Or Not?
68. What Is The Difference Between Var And Dynamic Types In C# 4.0?
69. How Can You Access A Private Method Of A Class?
70. Why Linq Is Having Select Clause At The End?
71. Name The Method Of Servicebase Class?
72. Name The Two Classes Are Required For Implementing A Windows Service?
73. What Are The Benefits Of Using Windows Services:
74. What Are Windows Services?
75. By Default Security Setting In .net?
76. Can Namespace Contain The Private Class?
77. Wcf And What Is Difference Between Wcf And Web Services?
78. Is Exe Is Machine Dependent?
79. What Is Difference Between Il And Dll ?
80. How Will You Deploy The Dll File In Gac?
81. If Dll And Exe Files Are Same It Means You Can Deploy Both The Files In Gac?
82. What Is The Task Perform By Clr?
83. Suppose Two Interfaces Have Same Method, So How Will You Implement These Methods In Derive Class?
84. What Is Using Keyword?
85. How To Get The Number After Decimal Point In .net?if The No Is 2.36. Result Should Be 36?
86. Wht Executescaler Method Is Used?
87. What Is Literal Control
88. How Many Languages .net Is Supporting Now?
89. How Asp .net Different From Asp?
90. What Is Smart Navigation In .net?
91. What Is View State In .net?
92. How Do You Validate The Controls In An Asp .net Page?
93. How To Manage Pagination In A Page Using .net?
94. Observations Between Vb.net And Vc#.net?
95. Advantages Of Migrating To Vb.net?
97. Using Activex Control In .net?
98. What Is Machine.config In .net?
99. What Is Web.config In .net?

1. What Is The Difference Between Vb And Vb.net?
2. What Is A Strong Name In .net?
3. What Is A Manifest In .net?
4. Creating A Key Pair In .net?
5. What Is The Difference Between “using System.data;” And Directly Adding The Reference From “add References Dialog Box”?
6. What Is Gac In .net?
7. What Is A Metadata In .net?
8. What Is Managed Code And Managed Data In .net?
9. What Is .net And .net Framework?
10. What’s A Windows Process?
11. What’s Typical About A Windows Process In Regards To Memory Allocation?
12. Why Do You Call It A Process? What’s Different Between Process And Application In .net, Not Common Computer Usage, Terminology?
13. What Distributed Process Frameworks Outside .net Do You Know?
14. What Are Possible Implementations Of Distributed Applications In .net?
15. When Would You Use .net Remoting And When Web Services?
16. What’s A Proxy Of The Server Object In .net Remoting?
17. What Are Remotable Objects In .net Remoting?
18. What Are Channels In .net Remoting?
19. What Security Measures Exist For .net Remoting In System.runtime.remoting?
20. What Is A Formatter?
21. Choosing Between Http And Tcp For Protocols And Binary And Soap For Formatters, What Are The Trade-offs?
22. What’s Singlecall Activation Mode Used For?
23. What’s Singleton Activation Mode?
24. How Do You Define The Lease Of The Object?
25. Can You Configure A .net Remoting Object Via Xml File?
26. How Can You Automatically Generate Interface For The Remotable Object In .net With Microsoft Tools?
27. What Are The Consideration In Deciding To Use .net Remoting Or Asp.net Web Services?
28. What’s Singlecall Activation Mode Used For?
29. What Do You Mean By A Windows Process In Regards To Memory Allocation?
30. What Is The Relationship Between A Process, Application Domain, And Application?
31. How To Decide Which To Use .net Remoting Or Asp.net Web Services?
32. What Is The Proxy Of The Server Object In .net Remoting?
33. What Do Mean By Remotable Objects In .net Remoting?
34. Which Class Does The Remote Object Has To Inherit?
35. What Are Two Different Types Of Remote Object Creation Mode In .net?
36. What Are The Situations You Will Use Singleton Architecture In Remoting ?
37. What Is Fundamental Of Published Or Precreated Objects In Remoting?
38. What Are The Ways In Which Client Can Create Object On Server In Cao Model?
39. Are Cao Stateful In Nature?
40. Is It A Good Design Practice To Distribute The Implementation To Remoting Client?
41. Which Config File Has All The Supported Channels/protocol?
42. Can Non-default Constructors Be Used With Single Call Sao?
43. How Can We Call Methods In Remoting Asynchronously?
44. What Is Asynchronous One-way Calls?
45. What Is Marshalling And What Are Different Kinds Of Marshalling?
46. What Is Objref Object In Remoting?
47. What Is A Web Service?
48. What Is Uddi?
49. What Is Disco?
50. What Is Wsdl?
51. What The Different Phase/steps Of Acquiring A Proxy Object In Webservice?
52. What Is File Extension Of Webservices?
53. Which Attribute Is Used In Order That The Method Can Be Used As Webservice?
54. What Are The Steps To Create A Webservice And Consume It?
55. Why Do You Call It A Process? What’s Different Between Process And Application In .net, Not Common Computer Usage, Terminology?
56. What’s Singlecall Activation Mode Used For?
57. What Is The Relation Between Classes And Objects?
58. Explain Different Properties Of Object Oriented Systems.
59. What Is Difference Between Association, Aggregation And Inheritance Relationships?
60. Explain The Features Of An Abstract Class In Net.
61. Difference Between Abstract Classes And Interfaces
62. Similarities And Difference Between Class And Structure In .net
63. Features Of Static/shared Classes.
65. What Is Finalize Method In .net?
66. What Are The Concepts Of Dispose Method?
67. Concurrency With Aop?
68. Transparent Caching With Aop ?
69. Security With Aop?
70. Aspect-oriented Programming?
71. What Is Manifest In .net?
72. What Is Garbage Collection? How To Force Garbage Collector To Run?
73. Explain Boxing And Unboxing In .net.
74. What Is Native Image Generator (ngen.exe)?
75. Explain Clr In Brief.
76. Describe How A .net Application Is Compiled And Executed.
77. Describe The Parts Of Assembly.
78. Overview Of Clr Integration.
79. Clr Triggers?
80. Steps For Creating Clr Trigger?
81. What Is A Clr (common Language Runtime)?
82. Explain The Concepts Of Cts And Cls(common Language Specification).
83. .net Framework
84. How Do We Access Crystal Reports In .net?
85. What Are The Various Components In Crystal Reports?
86. What Basic Steps Are Needed To Display A Simple Report In Crystal?
87. Asp.net 2.0 Themes
88. Should User Input Data Validation Occur Server-side Or Client-side? Why?
89. What’s A Bubbled Event?
90. What Is A Satellite Assembly?
91. .net Code Security
92. .net Assembly
93. .net Debug & Trace
94. Who Benefits From Ajax?
95. What Is Asp.net Ajax?
96. What Is .net?
97. What Versions Of .net Are There?
98. What Operating Systems Does The .net Framework Run On?
99. What Tools Can I Use To Develop .net Applications?
100. Why Did They Call It .net?

### C# .NET Interview Questions

1. What Is The Cli? Is It The Same As The Clr?
2. What Is C#?
3. What Is The Difference Between A Private Assembly And A Shared Assembly?
4. How Can I Develop An Application That Automatically Updates Itself From The Web?
5. Can I Write My Own .net Host?
6. Is It True That Objects Don’t Always Get Destroyed Immediately When The Last Reference Goes Away?
7. Should I Implement Finalize On My Class? Should I Implement Idisposable?
8. Do I Have Any Control Over The Garbage Collection Algorithm?
9. How Can I Find Out What The Garbage Collector Is Doing?
10. What Is The Lapsed Listener Problem?
11. I Want To Serialize Instances Of My Class. Should I Use Xmlserializer, Soapformatter Or Binaryformatter?
12. Xmlserializer Is Throwing A Generic “there Was An Error Reflecting Myclass” Error. How Do I Find Out What The Problem Is?
13. What Is Code Access Security (cas)?
14. How Does Cas Work?
15. I’m Having Some Trouble With Cas. How Can I Troubleshoot The Problem?
16. I Can’t Be Bothered With Cas. Can I Turn It Off?
17. Can I Look At The Il For An Assembly?
18. Can Source Code Be Reverse-engineered From Il?
19. How Can I Stop My Code Being Reverse-engineered From Il?
20. Can I Do Things In Il That I Can’t Do In C#?
21. Does .net Replace Com?
24. Can I Use Com Components From .net Programs?
25. Can I Use .net Components From Com Programs?
26. Is Atl Redundant In The .net World?
27. How Do I Stop A Thread?
28. How Do I Know When My Thread Pool Work Item Has Completed?
30. Tracing . Is There Built-in Support For Tracing/logging?
31. Can I Redirect Tracing To A File?
32. Are There Any Third Party Logging Components Available?
33. Miscellaneous. How Does .net Remoting Work?
34. When Should You Call The Garbage Collector In .net?
35. What Is The Difference Between An Event And A Delegate?
36. What Size Is A .net Object?
37. Will My .net App Run On 64-bit Windows?
38. .net 2.0 What Are The New Features Of .net 2.0?
39. What’s New In The .net 2.0 Class Library?
40. What Is Ajax?
41. Can Ajax Be Implemented In Browsers That Do Not Support The Xmlhttprequest Object?
42. Can Ajax Technology Work On Web Servers Other Than Iis?
43. Which Browsers Support The Xmlhttprequest Object?
44. What Are Ajax Extensions?
45. What Is Dojo?
46. How To Handle Multiple Or Concurrent Requests In Ajax?
47. What Is The Role Of Scriptmanager In Ajax?
48. Can We Override The Enablepartialrendering Property Of The Scriptmanager Class?
49. How To Use Multiple Scriptmanager Controls In A Web Page?
50. Whats The Difference Between Registerclientscriptblock, Registerclientscriptinclude And Registerclientscriptresource?
51. What Are Type/key Pairs In Client Script Registration? Can There Be 2 Scripts With The Same Type/key Pair Name?
52. What Are The Modes Of Updation In An Updatepanel? What Are Triggers Of An Updatepanel?
53. How To Control How Long An Ajax Request May Last?
54. What Is Asp.net Futures?
55. What Are Limitations Of Ajax?
56. How To Trigger A Postback On An Updatepanel From Javascript?
57. Which Request Is Better With Ajax, Get Or Post?
58. What Is The Asp.net Ajax Framework? What Versions Have Been Released So Far?
59. What Is The Asp.net Control Toolkit?
60. How To Create An Ajax Website Using Visual Studio?
61. How To Make Sure That Contents Of An Updatepanel Update Only When A Partial Postback Takes Place (and Not On A Full Postback)?
62. What Are The Requirements To Run Asp.net Ajax Applications On A Server?
63. Explain The Updatepanel?
64. Can I Use Asp.net Ajax With Any Other Technology Apart From Asp.net?
65. Difference Between Server-side Ajax Framework And Client-side Ajax Framework?
66. How Can You Debug Asp.net Ajax Applications?
67. Can We Call Server-side Code (c# Or Vb.net Code) From Javascript?
68. Can You Nest Updatepanel Within Each Other?
69. How Can You To Add Javascript To A Page When Performing An Asynchronous Postback?
70. Explain Differences Between The Page Execution Lifecycle Of An Asp.net Page And An Asp.net Ajax Page?
71. Is The Asp.net Ajax Control Toolkit(ajaxcontroltoolkit.dll) Installed In The Global Assembly Cache?
72. What Role “#&&” Plays In A Querysting?
73. Is There Any Property Names “isnavigating”?
74. Tell Name Of All The Control Of Ajax?
75. If There Are Multiple Update Panels On The Page Say Upd1 And Upd2. There Is A Button Placed In Upd1. How Can You Stop Upd2 To Update When Button Placed In Upd1 Is Clicked?
76. How Many Types Of Triggers Are There In Update Panel?
77. What Is The Displayafter Property In Updateprogress Control?
78. Is It Compulsory To Have Script Manager On The Page When You Are Using Any Control Of Ajax Control Tool Kit?
79. Which Property Needs To Be Set For Script Manager Control To Extend The Time Before Throwing Time Out Expection If No Response Is Received From The Server?
80. To Create Browser History Point Using Client Script, We Make Call Method…..
81. Default Value Of Enablehistory Attribute In Scriptmanager Is,
82. What Is A Design Pattern?
83. What Are Creational Design Patterns?
84. Whats The Difference Between Abstract Factory Pattern And Factory Pattern?
85. Describe The Builder Design Pattern
86. What Is The Lazy Design Pattern?
87. What Is The Prototype Design Pattern?
88. What Is The Singleton Design Pattern?
89. What Are Structural Design Patterns?
90. What Are The Different Types Of Proxy Patterns?
91. What Is A Behavioral Design Pattern?
92. What Is The Mvc Pattern (model View Controller Pattern)?
93. What Is The Gang Of Four Design Pattern?
94. When Should Design Patterns Be Used?
95. How Many Design Patterns Can Be Created In .net?
96. Describe The Ajax Design Pattern.
97. Explain The .net Framework.
98. Describe The .net Framework Architecture.
99. What Are The Components Of The .net Framework.
100. Explain The Role Of Assembly In The .net Framework.

### .NET Framework Interview Questions

1. Describe The Gac In The .net Framework.
2. What Is The Advantage Of Packaging Over Xcopy In .net?
3. .net Code Security Interview Questions With Answers
4. .net Debug & Trace Interview Questions With Answers
5. What Is Asp.net 2.0 Ajax?
6. The Components In The Asp.net 2.0 Ajax Packaging?
7. What Are The Benefits Of Ajax?
8. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
9. Balancing Client And Server Programming With Asp.net Ajax
10. Asp.net 2.0 Features?
11. What Is The Smallest Unit Of Execution In .net?
12. Will The Finally Block Get Executed If An Exception Has Not Occurred?
13. Asp.net Application Life Cycle
14. What’s Difference Between “optimistic” And “pessimistic” Locking?
15. Differences Between “dataset” And “datareader”.
16. What Are The Steps Involved To Fill A Dataset?
17. Describe The .net Base Class Library.
18. What Is The Difference Between Value Types And Reference Types?
19. Can You Store Multiple Data Types In System.array?
20. Explain An Object, Class And Method.
21. What Is The Difference Between Localization And Globalization?
22. What Is Unicode?
23. What Are Resource File And How Do We Generate Resource File?
24. Describe How To Implement Globalization And Localization In The Use Interface In .net.
25. Explain How To Prepare Culture-specific Formatting In .net.
26. Explain The Use Of Resource Manager Class In .net.
27. Asp.net Globalization-localization
28. Asp.net Overview
29. What’s The Top .net Class That Everything Is Derived From?
30. What Kinds Of Fonts Are Supported With Silverlight?
31. How Much Is The Pay-for-use Service If I Chose Not To Use Microsoft-sponsored Advertising?
32. What Is The Difference Between Silverlighttm Streaming And Other Video Sharing Services?
33. Why Is This Service Branded With Windows Livetm?
34. It’s Free-what’s The Catch?
35. Can I Tap Into Other Windows Livetm Services?
36. Do You Support Digital Rights Management To Protect My Videos?
37. How Does The Service Stream Content?
38. Can I Stream Live Content/events?
39. Do I Need To Have The Latest Version Of Windows Media Player Installed?
40. What Audio Or Video Formats Are Supported In Silverlight?
41. Will Silverlight Support All The Codecs Windows Media Player Supports?
43. Does Silverlight Support Mpeg4 And H.264 Video, Or Advanced Audio Coding (aac) Audio, Or Flash Video?
44. Explain Silverlight Architecture.
45. Difference Between Wpf And Silverlight
46. What Are The Limitations Of Using External Fonts In Silverlight?
47. Describe How To Perform Event Handling In Silver Light
48. Explain How To Add The Reference Of A Class Library Project In Silverlight Application Project
49. What Is Silverlight.js File? Explain With An Example.
50. What Is A .xap File? Explain With An Example.
51. Explain How Can Silverlight Use Asx Files.
52. Explain Silverlight Application Life-cycle
53. What Is The Role Of Silverlight Plugin In The Silverlight Application Life-cycle?
54. Explain The Purpose Of Storyboard.targetproperty.
55. Why Is Xap Important?
56. How Does Xap Work?
57. Explain The Use Of Clientbin Folder In Silverlight.
58. What Is Clipping In Silverlight?
59. What Is The Parent Xaml Tag Of Silverlight Page? Explain Its Purposes.
60. Explain With Example How To Change The Default Page Of The Silverlight Application.
61. How Many Xaml Files Are Created When You Create A New Project In Silverlight Through Visual Studio And What Are The Uses Of Those Files?
62. What Are The Programming Language That Can Be Used To Write The Backend Of The Silverlight Application?
63. Explain How To Set Silverlight Contents Width As 100%.
64. Can You Provide A List Of Layout Management Panels And When You Will Use Them?
65. Explain How To Apply Style Elements In A Silverlight Project?
66. What Are The Main Features And Benefits Of Silverlight?
67. When Would One Use Silverlight Instead Of Asp.net Ajax?
68. True Or False: A Web Service Can Only Be Written In .net?
69. Does Silverlight Have A System.console Class? Why?
70. What Are The Properties That Have To Be Initialized For Creating A Silverlight Control Using Createsilverlight()?
71. Explain The Path Instructions In Xaml
72. Explain The Resemblance Between Css And Silverlight, Regarding Overlapping Objects.
73. What Kind Of Brushed Does Silverlight Support?
74. Explain The Mouse Events That Silverlight Currently Supports.
75. Difference Between Mouseleftbuttondown And Mouseleftbuttonup In Silverlight.
76. What Is The Function Used For Removing An Event Listener?
77. How Would You Implement Drag-and-drop In Silverlight?
78. What Are The Properties Of The Eventargs Argument When Capturing Keyboard Events?
79. What Is The Function Used To Get A Reference To An Object Inside The Silverlight Control?
80. What Objects Support Tranformations? What Are The Transformations That Silverlight Supports For The Elements?
81. Explain The Steps Needed To Be Performed In Order To Create An Animation In Xaml
82. What Are The Animation Types Supported By Silverlight?
83. Explain The Concept Of Keyframe. What Is The Difference Between Silverlight And Flash Regarding Animations?
84. How Many Classes Can A Single .net Dll Contain?
85. How Could You Determine The Media Position When Playing A Video In Silverlight?
86. Name Two Properties Common In Every Validation Control?
87. What Is The Global.asax Used For?
88. How Could You Modify Xaml Content From Javascript?
89. What Are The Necessary Step That Need To Be Performed In Order To Download Content From Within Silverlight?
90. What Asp.net Control Can Embed Xaml Into Asp.net Pages?
91. Does Silverlight Supports Database Connectivity? Explain
92. What Is The Codec Silverlight Supports For Hd Streaming?
93. How Can Iis Improve Silverlight Streaming?
94. Whats An Assembly?
95. What Is Smpte Vc-1?
96. What Is Xaml? Are Xaml File Compiled Or Built On Runtime?
97. What Are Dependency Properties In Silverlight?
98. Will Silverlight Support Digital Rights Management?
99. Explain The Relationship Between Silverlight And Windows Media Technologies?
100. What Is The Relationship Between Silverlight And Windows Media Player?

### ASP.NET Interview Questions For Experienced

1. Will Silverlight-based Applications And Content Run On Any Web Server? What Are The Benefits To Running It On Servers Running Windows?
2. What Features Are Missing From Silverlight Presentation Markup That Will Be Supported In Windows Presentation Foundation?
3. Is Silverlight Supported On Various Locales?
4. What Are The Different Ways To Display Text With Silverlight?
5. What Is Xaml ?
6. What Is The Difference Between Wpf And Silverlight?
7. Can You Name Built-in Layout Panels You Have Been Using With Silverlight?
8. How Can I Switch To Expression Blend From Visual Studio?
9. How Can You Set Image Source Dynamically From C# Application To”test.png” File?
10. How Can I Create Image Pieces/sub Image?
11. How Does Silverlight 2 Differ From Adobe Flash?
12. Can You Elaborate How To Start A Silverlight Application With Visual Studio?
13. What Is Silverlight Tool Kit?
14. What Happened When I Press F5 Within Visual Studio To Run Silverlight Application?
15. What Is Storyboard?
16. Can I Add More Than One .xaml Pages In Silverlight Application?
17. What Is The Best Place To Start Silverlight Application?
18. Is Silverlight The Official Name For “wpf/e”?
19. Does Silverlight Web Application Work With All Browsers ?
20. Is Silverlight A New Media Player?
21. How Is My Content Secured From Unauthorized Access?
22. Explain Form Level Validation And Field Level Validation
24. Asp.net State Management
25. Asp.net Caching
26. Define Xslt.
27. What Is Xpath?
30. How Can You Sort The Elements Of The Array In Descending Order?
31. What’s The .net Collection Class That Allows An Element To Be Accessed Using A Unique Key?
32. Can You Prevent Your Class From Being Inherited By Another Class?
34. What Is A Satellite Assembly?
36. What Is .net Framework?
37. Is .net A Runtime Service Or A Development Platform?
38. What Are The New Features Of Framework 1.1 ?
39. How Do I Define My Own Code Group?
40. How Do I Change The Permission Set For A Code Group?
41. Can I Create My Own Permission Set?
42. I’m Having Some Trouble With Cas. How Can I Diagnose My Problem?
43. I Can’t Be Bothered With All This Cas Stuff. Can I Turn It Off?
44. What Is Msil, Il?
45. Can I Write Il Programs Directly?
46. What Is Jit (just In Time)? How It Works?
47. Which Namespace Is The Base Class For .net Class Library?
48. What Is Event – Delegate? Clear Syntax For Writing A Event Delegate
49. What Are Object Pooling And Connection Pooling And Difference? Where Do We Set The Min And Max Pool Size For Connection Pooling?
50. Interop Services?
51. What Are Server Controls?
52. What Is Exception Handling?
53. What Are The Different Types Of Assemblies?
54. What Are Satellite Assemblies? How You Will Create This? How Will You Get The Different Language Strings?
55. What Is Jagged Arrays?
56. What Is Assembly Manifest? What All Details The Assembly Manifest Will Contain?
57. Difference Between Assembly Manifest & Metadata?
58. What Is Global Assembly Cache (gac) And What Is The Purpose Of It? (how To Make An Assembly To Public? Steps) How More Than One Version Of An Assembly Can Keep In Same Place?
59. How Do I Know When My Thread Pool Work Item Has Completed?
60. How To Find Methods Of A Assembly File (not Using Ildasm)
61. What Is Garbage Collection In .net? Garbage Collection Process?
63. What Is Reflection In .net? Namespace? How Will You Load An Assembly Which Is Not Referenced By Current Assembly?
64. What Is Custom Attribute? How To Create? If I’m Having Custom Attribute In An Assembly, How To Say That Name In The Code?
65. What Is The Managed And Unmanaged Code In .net?
66. How Do You Create Threading In .net? What Is The Namespace For That?
67. Using Directive Vs Using Statement
68. Describe The Managed Execution Process?
69. What Is Active Directory? What Is The Namespace Used To Access The Microsoft Active Directories? What Are Adsi Directories?
70. How Garbage Collector (gc) Works?
71. Why Do We Need To Call Cg.supressfinalize?
72. What Is Nmake Tool?
73. What Are Namespaces?
74. What Is Rcw (runtime Callable Wrappers)?
75. What Is Ccw (com Callable Wrapper)
76. How Will You Register Com+ Services?
77. What Is Use Of Contextutil Class?
78. What Is Pinvoke?
79. Is It True That Com Objects No Longer Need To Be Registered On The Server?
80. Can .net Framework Components Use The Features Of Component Services?
81. What Are The Oops Concepts?
82. What Is The Difference Between A Struct And A Class?
84. What Is Method Overriding? How To Override A Function In C#?
85. Can We Call A Base Class Method Without Creating Instance?
86. You Have One Base Class Virtual Function How Will Call That Function From Derived Class?
87. In Which Cases You Use Override And New Base?
88. What Are Sealed Classes In C#?
89. What Is Polymorphism? How Does Vb.net/c# Achieve Polymorphism?
90. Explain About Protected And Protected Internal, “internal” Accessspecifier?
91. Difference Between Type Constructor And Instance Constructor? What Is Static Constructor, When It Will Be Fired? And What Is Its Use?
92. What Is Private Constructor? And It’s Use? Can You Create Instance Of A Class Which Has Private Constructor?
93. I Have 3 Overloaded Constructors In My Class. In Order To Avoid Making Instance Of The Class Do I Need To Make All Constructors To Private?
94. Overloaded Constructor Will Call Default Constructor Internally?
95. What Is The Difference Between Finalize And Dispose (garbage Collection)
96. Is Goto Statement Supported In C#? How About Java?
97. What’s Different About Switch Statements In C#?
99. How Would You Connect To Database Using .net?
100. Difference Between Oledb Provider And Sqlclient ?

### .NET Interview Questions For 5+ Years Experience

1. What Are The Different Namespaces Used In The Project To Connect The Database? What Data Providers Available In .net To Connect To Database?
2. Which Method Do You Invoke On The Dataadapter Control To Load Your Generated Dataset With Data?
3. Explain Different Methods And Properties Of Datareader Which You Have Used In Your Project?
4. What Happens When We Issue Dataset.readxml Command?
5. In How Many Ways We Can Retrieve Table Records Count? How To Find The Count Of Records In A Dataset?
6. How To Check If A Datareader Is Closed Or Opened?
7. Differences Between Dataset.clone And Dataset.copy?
8. What Is Method To Get Xml And Schema From Dataset?
9. Difference Between Application Events And Session Events
10. Difference Between Asp Session And Asp.net Session?
11. What Is Cookie Less Session? How It Works?
12. What Method Do You Use To Explicitly Kill A Users Session?
13. What Are The Different Ways You Would Consider Sending Data Across Pages In Asp (i.e Between 1.asp To 2.asp)?
14. What Is State Management In .net And How Many Ways Are There To Maintain A State In .net? What Is View State?
15. What Are The Disadvantages Of View State / What Are The Benefits?
16. When Maintaining Session Through Sql Server, What Is The Impact Of Read And Write Operation On Session Objects?
17. Explain The Differences Between Server-side And Client-side Code?
18. Which Asp.net Configuration Options Are Supported In The Asp.net Implementation On The Shared Web Hosting Platform?
19. What Is Role-based Security?
20. How Do You Specify Whether Your Data Should Be Passed As Query String And Forms (mainly About Post And Get)
21. Which Two Properties Are There On Every Validation Control?
22. How Do You Use Css In Asp.net?
23. How Do You Implement Postback With A Text Box?
24. What Is Sql Injection?
25. Asp.net – How To Find Last Error Which Occurred?
26. What Is The Use Of sessionstate Tag In The Web.config File?
27. What Are The Different Modes For The Sessionstates In The Web.config File?
28. Is It Possible For Me To Change My .aspx File Extension To Some Other Name?
29. What Is A Webservice And What Is The Underlying Protocol Used In It?
30. In A Webservice, Need To Display 10 Rows From A Table. Which Is The Best Choice Among Datareader Or Dataset?
31. Are Web Services A Replacement For Other Distributed Computing Platforms?
32. How To Generate Proxy Class Other Than .net App And Wsdl Tool?
33. What Is A Proxy In Web Service? How Do I Use A Proxy Server When Invoking A Web Service?
34. How You Will Protect / Secure A Web Service?
35. What Is Remoting?
36. Cao And Sao.
37. Difference Between Singleton And Singlecall.
38. In Which Process Does Iis Runs (was Asking About The Exe File)
39. Where Are The Iis Log Files Stored?
40. How Do I Send An Email Message From My Asp.net Page?
41. What Is An Il?
42. What Is Difference Between Namespace And Assembly?
43. What Is The Use Of Errorprovider Control In .net?
44. Can Any Object Be Stored In A Viewstate In .net?
45. Difference Between Class And Interface In .net?
47. Differences Between Dll And Exe?
48. What Do You Mean By Authentication And Authorization?
49. Where Do You Add An Event Handler?
50. Differentiate Between Client-side And Server-side Validations In Web Pages?
51. What Does The Orientation Property Do In A Menu Control?
52. Which Method Is Used To Force All The Validation Controls To Run?
53. What Is Viewstate?
54. Differentiate Globalization And Localization?
55. How Can You Register A Custom Server Control To A Web Page?
56. What Is Iis? Why Is It Used?
57. Define A Multilingual Website?
58. What Are The Advantages Of The Code-behind Feature?
59. Which Is The Parent Class Of The Web Server Control?
60. How Can We Identify That The Page Is Post Back?
61. In Which Event Are The Controls Fully Loaded?
62. Which Properties Are Used To Bind A Datagridview Control?
63. What Is Autopostback?
64. What Are The Parameters That Control Most Of Connection Pooling Behaviours?
65. What Are Different Types Of Authentication Techniques That Are Used In Connection Strings To Connect .net Applications With Microsoft Sql Server?
66. Which Adapter Should You Use, If You Want To Get The Data From An Access Database?
67. What Are The Pre-requisites For Connection Pooling?
68. Name The Method That Needs To Be Invoked On The Dataadapter Control To Fill The Generated Dataset With Data?
69. Which Property Is Used To Check Whether A Datareader Is Closed Or Opened?
70. What Is The Role Of The Dataset Object In Ado.net?
71. Which Architecture Does Datasets Follow?
72. Mention The Namespace That Is Used To Include .net Data Provider For Sql Server In .net Code?
73. What Is The Meaning Of Object Pooling?
74. What Are Tuples?
75. What Is The Difference Between Int And Int32?
76. Which Method Do You Use To Enforce Garbage Collection In .net?
77. What Is Managed Extensibility Framework?
78. What Is Microsoft Intermediate Language (msil)?
79. Mention The Execution Process For Managed Code?
80. What Are The Benefits Of .net Framework?
81. Mention The Core Components Of .net Framework?
82. Briefly Describe The Roles Of Clr In .net Framework?
83. Why Is String Called Immutable Data Type?
84. What Is Side-by-side Execution? Can Two Applications, One Using A Private Assembly And Other Using A Shared Assembly, Be Stated As Side-by-side Executables?
85. Explain The Differences Between Managed And Unmanaged Code?
86. What Is The Maximum Number Of Classes That Can Be Contained In One Dll File?
87. Can One Dll File Contains The Compiled Code Of More Than One .net Language?
88. Explain The Different Types Of Assemblies?

## C Program To Add Digits Of A Number

C Program To Add Digits Of A Number.  If you are looking find sum of the digits of a number program in C, here in this tutorial we will help you to learn how to write a C program to compute sum of digits in a given number.

## C Program to Add Digits of a Number

Learn how to write a C program to find sum of digits of a number. Writing C Program to add digits of a given number can be done using various techniques but here in this program, we show how to write a C program to find sum of digits of a number using while loop in a proper way.

### How do you find the sum of digits in C?

If a user enters a number 1234, then we have to write a logic to calculate sum of the digits of 1234. That is 1 + 2 + 3 + 4 = 10. The program should read the individual digits and then it should add digits and print sum of the digits in a given number.

### C Program to Compute Digits of a Number Source Code

Just copy paste the below source code to find sum of the digits of a number in C compiler to test, how the source code works. Happy Learning.

```/* C program to add digits of a number - AddDigits.C */

#include <stdio.h>

void main()
{
long num, temp, digit, sum = 0;

printf("Enter the number to find sum of the digits: \n");
scanf("%ld", &num);
temp = num;
while (num > 0)
{
digit = num % 10;
sum = sum + digit;
num /= 10;
}
printf("Given number is = %ld\n", temp);
printf("Sum of the digits of %ld = %ld\n", temp, sum);
}```

### C Program to Find Sum of Digits of a Number Output

Run the above program to add digits of a given number to print sum of digits. For this enter a number to check, the c compiler will execute the logic and display the sum of the digits of a number.

Output:

Enter the number to find sum of the digits: 1234

Given number is = 1234

Sum of the digits of 1234 = 10

## Ansible Interview Questions And Answers For Experienced

Advanced Ansible Interview Questions and answers for experienced. Here in this post coding compiler presenting list of scenario based ansible devops interview questions and answers. By reading these ansible technical interview questions, you will get the good knowledge to face ansible job interview. Good luck for your future and happy learning.

## Ansible Interview Questions

1. How can I set the PATH or any other environment variable for a task or entire playbook?
2. How do I handle different machines needing different user accounts or ports to log in with?
3. How do I get ansible to reuse connections, enable Kerberized SSH, or have Ansible pay attention to my local SSH config file?
4. How do I configure a jump host to access servers that I have no direct access to?
5. How do I speed up management inside EC2?
6. How do I handle python pathing not having a Python 2.X in /usr/bin/python on a remote machine?
7. What is the best way to make content reusable/redistributable?
8. Where does the configuration file live and what can I configure in it?
9. How do I disable cowsay?
10. How do I see a list of all of the ansible_ variables?
11. How do I see all the inventory vars defined for my host?
12. How do I loop over a list of hosts in a group, inside of a template?
13. How do I access a variable name programmatically?
14. How do I access a variable of the first host in a group?
15. How do I copy files recursively onto a target host?
16. How do I access shell environment variables?
17. How do I generate crypted passwords for the user module?
18. Is there a web interface / REST API / etc?
19. How do I keep secret data in my playbook?
20. When should I use {{ }}? Also, how to interpolate variables or dynamic variable names
21. Why don’t you ship in X format?

## Ansible Interview Questions And Answers

Ansible Interview Questions # 1) How can I set the PATH or any other environment variable for a task or entire playbook?

A) Setting environment variables can be done with the environment keyword. It can be used at the task or the play level:

```environment:
PATH: "{{ ansible_env.PATH }}:/thingy/bin"
SOME: value
```

Note

starting in 2.0.1 the setup task from gather_facts also inherits the environment directive from the play, you might need to use the |default filter to avoid errors if setting this at play level.

Ansible Interview Questions # 2) How do I handle different machines needing different user accounts or ports to log in with?

A) Setting inventory variables in the inventory file is the easiest way.

Note

Ansible 2.0 has deprecated the “ssh” from `ansible_ssh_user`,  `ansible_ssh_host`, and `ansible_ssh_port` to become `ansible_user``ansible_host`, and `ansible_port`.

If you are using a version of Ansible prior to 2.0, you should continue using the older style variables (`ansible_ssh_*`). These shorter variables are ignored, without warning, in older versions of Ansible.

For instance, suppose these hosts have different usernames and ports:

```[webservers]
asdf.example.com  ansible_port=5000   ansible_user=alice
jkl.example.com   ansible_port=5001   ansible_user=bob
```

You can also dictate the connection type to be used, if you want:

```[testcluster]
localhost           ansible_connection=local
/path/to/chroot1    ansible_connection=chroot
foo.example.com     ansible_connection=paramiko
```

You may also wish to keep these in group variables instead, or file them in a group_vars/<groupname> file. See the rest of the documentation for more information about how to organize variables.

Ansible Interview Questions # How do I get ansible to reuse connections, enable Kerberized SSH, or have Ansible pay attention to my local SSH config file?

A) Switch your default connection type in the configuration file to ‘ssh’, or use ‘-c ssh’ to use Native OpenSSH for connections instead of the python paramiko library. In Ansible 1.2.1 and later, ‘ssh’ will be used by default if OpenSSH is new enough to support ControlPersist as an option.

Paramiko is great for starting out, but the OpenSSH type offers many advanced options. You will want to run Ansible from a machine new enough to support ControlPersist, if you are using this connection type.

You can still manage older clients. If you are using RHEL 6, CentOS 6, SLES 10 or SLES 11 the version of OpenSSH is still a bit old, so consider managing from a Fedora or openSUSE client even though you are managing older nodes, or just use paramiko.

We keep paramiko as the default as if you are first installing Ansible on an EL box, it offers a better experience for new users.

Ansible Interview Questions # How do I configure a jump host to access servers that I have no direct access to?

A) With Ansible 2, you can set a ProxyCommand in the ansible_ssh_common_args inventory variable. Any arguments specified in this variable are added to the sftp/scp/ssh command line when connecting to the relevant host(s). Consider the following inventory group:

```[gatewayed]
foo ansible_host=192.0.2.1
bar ansible_host=192.0.2.2
```

You can create group_vars/gatewayed.yml with the following contents:

```ansible_ssh_common_args: '-o ProxyCommand="ssh -W %h:%p -q [email protected]"'
```

Ansible will append these arguments to the command line when trying to connect to any hosts in the group gatewayed. (These arguments are used in addition to any ssh_args from ansible.cfg, so you do not need to repeat global ControlPersist settings in ansible_ssh_common_args.)

Note that ssh -W is available only with OpenSSH 5.4 or later. With older versions, it’s necessary to execute nc %h:%p or some equivalent command on the bastion host.

With earlier versions of Ansible, it was necessary to configure a suitable ProxyCommand for one or more hosts in ~/.ssh/config, or globally by setting ssh_args in ansible.cfg.

Ansible Interview Questions # How do I speed up management inside EC2?

A) Don’t try to manage a fleet of EC2 machines from your laptop. Connect to a management node inside EC2 first and run Ansible from there.

Ansible Interview Questions # How do I handle python pathing not having a Python 2.X in /usr/bin/python on a remote machine?

A) While you can write ansible modules in any language, most ansible modules are written in Python, and some of these are important core ones.

By default, Ansible assumes it can find a /usr/bin/python on your remote system that is a 2.X version of Python, specifically 2.6 or higher.

Setting the inventory variable ‘ansible_python_interpreter’ on any host will allow Ansible to auto-replace the interpreter used when executing python modules.

Thus, you can point to any python you want on the system if /usr/bin/python on your system does not point to a Python 2.X interpreter.

Some Linux operating systems, such as Arch, may only have Python 3 installed by default. This is not sufficient and you will get syntax errors trying to run modules with Python 3. Python 3 is essentially not the same language as Python 2.

Python 3 support is being worked on but some Ansible modules are not yet ported to run under Python 3.0. This is not a problem though as you can just install Python 2 also on a managed host.

Do not replace the shebang lines of your python modules. Ansible will do this for you automatically at deploy time.

Ansible Interview Questions # What is the best way to make content reusable/redistributable?

A) If you have not done so already, read all about “Roles” in the playbooks documentation. This helps you make playbook content self-contained, and works well with things like git submodules for sharing content with others.

If some of these plugin types look strange to you, see the API documentation for more details about ways Ansible can be extended.

Ansible Interview Questions # Where does the configuration file live and what can I configure in it?

A) See Configuration file.

Ansible Interview Questions # How do I disable cowsay?

A) If cowsay is installed, Ansible takes it upon itself to make your day happier when running playbooks. If you decide that you would like to work in a professional cow-free environment, you can either uninstall cowsay, or set the `ANSIBLE_NOCOWS` environment variable:

```export ANSIBLE_NOCOWS=1
```

Ansible Interview Questions # How do I see a list of all of the ansible_ variables?

A) Ansible by default gathers “facts” about the machines under management, and these facts can be accessed in Playbooks and in templates. To see a list of all of the facts that are available about a machine, you can run the “setup” module as an ad-hoc action:

```ansible -m setup hostname
```

This will print out a dictionary of all of the facts that are available for that particular host. You might want to pipe the output to a pager.

### Ansible Interview Questions And Answers For Experienced

Ansible Interview Questions # How do I see all the inventory vars defined for my host?

A) By running the following command, you can see vars resulting from what you’ve defined in the inventory:

```ansible -m debug -a "var=hostvars['hostname']" localhost
```

Ansible Interview Questions # How do I loop over a list of hosts in a group, inside of a template?

A) A pretty common pattern is to iterate over a list of hosts inside of a host group, perhaps to populate a template configuration file with a list of servers. To do this, you can just access the “\$groups” dictionary in your template, like this:

```{% for host in groups['db_servers'] %}
{{ host }}
{% endfor %}
```

If you need to access facts about these hosts, for instance, the IP address of each hostname, you need to make sure that the facts have been populated. For example, make sure you have a play that talks to db_servers:

```- hosts:  db_servers
- debug: msg="doesn't matter what you do, just that they were talked to previously."
```

Then you can use the facts inside your template, like this:

```{% for host in groups['db_servers'] %}
{% endfor %}
```

Ansible Interview Questions # How do I access a variable name programmatically?

A) An example may come up where we need to get the ipv4 address of an arbitrary interface, where the interface to be used may be supplied via a role parameter or other input. Variable names can be built by adding strings together, like so:

```{{ hostvars[inventory_hostname]['ansible_' + which_interface]['ipv4']['address'] }}
```

The trick about going through hostvars is necessary because it’s a dictionary of the entire namespace of variables. ‘inventory_hostname’ is a magic variable that indicates the current host you are looping over in the host loop.

Ansible Interview Questions # How do I access a variable of the first host in a group?

A) What happens if we want the ip address of the first webserver in the webservers group? Well, we can do that too. Note that if we are using dynamic inventory, which host is the ‘first’ may not be consistent, so you wouldn’t want to do this unless your inventory is static and predictable. (If you are using Ansible Tower, it will use database order, so this isn’t a problem even if you are using cloud based inventory scripts).

Anyway, here’s the trick:

```{{ hostvars[groups['webservers'][0]]['ansible_eth0']['ipv4']['address'] }}
```

Notice how we’re pulling out the hostname of the first machine of the webservers group. If you are doing this in a template, you could use the Jinja2 ‘#set’ directive to simplify this, or in a playbook, you could also use set_fact:

```- set_fact: headnode={{ groups[['webservers'][0]] }}

```

Notice how we interchanged the bracket syntax for dots – that can be done anywhere.

### Ansible Devops Interview Questions And Answers

Ansible Interview Questions # How do I copy files recursively onto a target host?

A) The “copy” module has a recursive parameter. However, take a look at the “synchronize” module if you want to do something more efficient for a large number of files. The “synchronize” module wraps rsync. See the module index for info on both of these modules.

Ansible Interview Questions # How do I access shell environment variables?

A) If you just need to access existing variables, use the ‘env’ lookup plugin. For example, to access the value of the HOME environment variable on the management machine:

```---
# ...
vars:
local_home: "{{ lookup('env','HOME') }}"
```

If you need to set environment variables, see the Advanced Playbooks section about environments.

Starting with Ansible 1.4, remote environment variables are available via facts in the ‘ansible_env’ variable:

```{{ ansible_env.SOME_VARIABLE }}
```

Ansible Interview Questions # do I generate crypted passwords for the user module?

A) The mkpasswd utility that is available on most Linux systems is a great option:

```mkpasswd --method=sha-512
```

If this utility is not installed on your system (e.g. you are using OS X) then you can still easily generate these passwords using Python. First, ensure that the Passlib password hashing library is installed:

```pip install passlib
```

Once the library is ready, SHA512 password values can then be generated as follows:

```python -c "from passlib.hash import sha512_crypt; import getpass; print sha512_crypt.using(rounds=5000).hash(getpass.getpass())"
```

Use the integrated Hashing filters to generate a hashed version of a password. You shouldn’t put plaintext passwords in your playbook or host_vars; instead, use Using Vault in playbooks to encrypt sensitive data.

Ansible Interview Questions # Is there a web interface / REST API / etc?

A) Yes! Ansible, Inc makes a great product that makes Ansible even more powerful and easy to use. See Ansible Tower.

Ansible Interview Questions # How do I keep secret data in my playbook?

A) If you would like to keep secret data in your Ansible content and still share it publicly or keep things in source control, see Using Vault in playbooks.

In Ansible 1.8 and later, if you have a task that you don’t want to show the results or command given to it when using -v (verbose) mode, the following task or playbook attribute can be useful:

```- name: secret task
shell: /usr/bin/do_something --value={{ secret_value }}
no_log: True
```

This can be used to keep verbose output but hide sensitive information from others who would otherwise like to be able to see the output.

The no_log attribute can also apply to an entire play:

```- hosts: all
no_log: True
```

Though this will make the play somewhat difficult to debug. It’s recommended that this be applied to single tasks only, once a playbook is completed. Note that the use of the no_log attribute does not prevent data from being shown when debugging Ansible itself via the `ANSIBLE_DEBUG` environment variable.

### Ansible Real Time Interview Questions And Answers

Ansible Interview Questions # When should I use {{ }}? Also, how to interpolate variables or dynamic variable names

A) A steadfast rule is ‘always use {{ }} except when when:‘. Conditionals are always run through Jinja2 as to resolve the expression, so when:failed_when: and changed_when: are always templated and you should avoid adding {{}}.

In most other cases you should always use the brackets, even if previously you could use variables without specifying (like with_ clauses), as this made it hard to distinguish between an undefined variable and a string.

Another rule is ‘moustaches don’t stack’. We often see this:

```{{ somevar_{{other_var}} }}
```

The above DOES NOT WORK, if you need to use a dynamic variable use the hostvars or vars dictionary as appropriate:

```{{ hostvars[inventory_hostname]['somevar_' + other_var] }}
```

Ansible Interview Questions # Why don’t you ship in X format?

A) Several reasons, in most cases it has to do with maintainability, there are tons of ways to ship software and it is a herculean task to try to support them all. In other cases there are technical issues, for example, for python wheels, our dependencies are not present so there is little to no gain.

References: Ansible Website