GeekInterview.com
Answered Questions

Tricky C program

Asked By: dineshtom | Asked On: Aug 29th, 2010

Write a C program to find a peculiar two digit number which is three times the sum of its digits.

Answered by: paruchurimaheshgoud on: Aug 17th, 2011

simple logic

Code
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int a,b,c,d;
  6. for(a=1;a<99;a++)
  7. {
  8. b=a%10;
  9. c=a/10;
  10. d=3*(b+c);
  11. if(d==a)
  12. cout<<"spl"<<a<<endl;
  13. }
  14.  
  15. return 0;
  16. }

Answered by: Rajath on: Aug 5th, 2011

The only peculiar two digit num is 27..

Code
  1. #include<stdio.h>
  2. void main()
  3.  
  4.  
  5. {
  6.     int i,j;
  7.     for(i=1;i<9;i++)
  8.     {
  9.         for(j=1;j<9;j++)
  10.         {
  11.             if((10*i)+j==3*(i+j))
  12.             {
  13.                 printf("The value is %d%d",i,j);
  14.                 return;
  15.             }
  16.         }
  17.     }
  18.     return 0;
  19. }
  20.  

Pointer use

Asked By: nipa123456 | Asked On: Aug 22nd, 2010

Why do we use pointer instead of variable?

Answered by: jbode on: Sep 30th, 2010

We *must* use pointers for the following:1. To fake pass-by-reference semantics;2. To track dynamically allocated memory;3. To build self-referential data structures.If we want a function to modify...

Answered by: Cmkraj on: Sep 15th, 2010

List of pros & cons of pointers over variables1. Fetching speed is faster thru pointers as pointers directly access the memory2. Useful in the concepts of pass by reference. variable value can be chan...

Pointer to an array

Asked By: kakarukoireng | Asked On: Aug 22nd, 2010

What is pointer to an array? Explain with example.

Answered by: jbode on: Oct 5th, 2010

For any given data type T, a pointer to an array of T is declared as "T (*arr)[N];".  It has the same value as a pointer to the first element of the array, but a different type (T (*)[N...

Answered by: anandkumarjha on: Aug 28th, 2010

Actually there does not exist array rather here is a term called pointer to an array.let me explain with the help of one example.suppose we have following code#include<stdio.h>#define i 10main()...

Recursion

Asked By: masveera | Asked On: Aug 13th, 2010

What is the basic principle behind recursion, other than function calling itself again & again and in which real time scenario we use it?

Answered by: jbode on: Oct 4th, 2010

The basic idea behind recursion is that you're solving one big problem by breaking it into multiple smaller, easier-to-solve problems.  This can make the algorithm easier to write and un...

Answered by: anandkumarjha on: Aug 28th, 2010

Recursion is the process of calling function again and again.During the recursion many push and pop operation is done in our registers memory. That's why recursion has very poor performance.Our compu...

Use of static

Asked By: anandkumarjha | Asked On: Aug 9th, 2010

What is the use of static in (public static void main string args[])

Answered by: amrutabhavana on: Sep 4th, 2011

We can use static key word for any method which does not require an object to call, so main method is automatically called by the JVM so it does not require any object it is mentioned as static. We ca...

Answered by: Suresh on: Aug 6th, 2011

without creating instance of that class to invoke the main method static keyword is used, by giving the name of the class main method gets invoked.

Object class

Asked By: zoomer09 | Asked On: Aug 2nd, 2010

When you declare a class, why does it automatically extends to object class? Give 2 reasons.

Answered by: mani.sivapuram on: Mar 11th, 2011

When preparing the Java by JavaPeople they thought like every object what we prepare should have some common property so that we can do some basic operations like for example clone() method.  So ...

Answered by: anandkumarjha on: Aug 9th, 2010

Object class is the super class of all the classes provided by java.lang package.  And I think you know that all the basic functions to write a program like println() are the content of the class...

Bluetooth modulation processes

Asked By: debrajmukhopadhyay | Asked On: May 18th, 2009

What kind of modulation processes are ADOpted in bluetooth technology?

Answered by: khaled on: Oct 28th, 2011

the modulation is FSK

Answered by: anandkumarjha on: Aug 11th, 2010

Bluetooth uses FHSS (Frequency Hopping Spread Spectrum) technique which is used in spread spectrum signal transmission.  To understand Frequency hoping spread spectrum, its is necessary to un...

What is difference between main() and void main()?

Asked By: M.SREEDHAR REDDY | Asked On: May 1st, 2007

Answered by: anandkumarjha on: Oct 4th, 2010

The programms under the main() function means that this main() function is of int type as any function is declared as int by default in c language.it means it will return the value which it takes and ...

Answered by: kbjarnason on: Jul 1st, 2010

The short answer is that void main() has never been a legitimate usage in C, and a compiler, seeing it, is well within its rights to spew an error, or worse, spew garbage results if you use it.By cont...

Difference between ntfs and fat32?

Asked By: ravi_poo2002 | Asked On: Mar 24th, 2006

Star Read Best Answer

Editorial / Best Answer

Answered by: Aparna Patil

Answered On : Mar 24th, 2006

NTFS

1)allows access local to w2k,w2k3,XP,win NT4 with SP4 & later may get access for somefile.

2)Maximum size of partition is 2 Terabytes & more.

3)Maximum File size is upto 16TB.

4)File & folder Encryption is possible only in NTFS.

FAT 32

1)Fat 32 Allows access to win 95,98,win millenium,win2k,xp on local partition.

2)Maximum size of partition is upto 2 TB.

3)Maximum File size is upto 4 GB.

4)File & folder Encryption is not possible.

Answered by: Allaya on: Dec 3rd, 2012

New Technology File System

Answered by: Rohit Behal on: Oct 5th, 2012

NTFS= New Technology File System. or Network Technology File System

Why is transient modifier used and where in real life?

Asked By: Srikanth | Asked On: Oct 16th, 2005

Many people disturbed me about the solution,some one help me.

Answered by: anandkumarjha on: Oct 3rd, 2010

Volatile modifier is being used in the field of multithreading because whenever all the threads access to a single variable ,they have their seperate copy of that variable and if they modifies the var...

Answered by: Raja Chaithanya Bangaru on: Nov 11th, 2005

In Java, all objects are not serializable.In distibuted environment,an object needs to be serializable.(serialization means writing the state of an object to a file using output stream so that it pers...

 what is the difference between declaring a variable and defining a variable?

Asked By: Interview Candidate | Asked On: Mar 6th, 2005

Declaring a variable means describing its type to the compiler but not allocating any space for it. Defining a variable means declaring it and also allocating space to hold the variable. You can also initialize a variable at the time it is defined.

Answered by: anandkumarjha on: Aug 31st, 2010

As far as declaration of variable is concerned it only shows the properties of variable and we declare the data type which are to be used by that variable but when it comes to the definition of variab...

Answered by: prabhu on: May 5th, 2007

int num;

This statement is declaration and also defination since it also allocates memory for variable num.

But when you use following statement

extern int num;

It is only declaration since you are not allocating memory here.

What is a const pointer?

Asked By: Interview Candidate | Asked On: Mar 6th, 2005

Star Read Best Answer

Editorial / Best Answer

Answered by: Prasad

Answered On : Apr 27th, 2007

Constant pointer is NOT pointer to constant. Constant pointer means the pointer is constant. For eg:
Constant Pointer
int * const ptr2 indicates that  ptr2 is a pointer which is constant. This means that ptr2 cannot be made to point to another integer. However the integer pointed by ptr2 can be changed.



Where as a Pointer to constant is
const int * ptr1 indicates that ptr1 is a pointer that points to a constant integer. The integer is constant and cannot be changed. However, the pointer ptr1 can be made to point to some other integer.

Answered by: Jegan Chakkravarthy on: Jan 7th, 2011

An ordinary pointer variable preceeded with the "const" modifier. This prevents the value initialised from getting changed.

Answered by: anandkumarjha on: Aug 28th, 2010

Absolutely there is the vast difference between constant pointer and the pointer to a constant.it will be more clear with the examples of both the types.CONSTANT POINTER:-int const *a...this means the...

Array is an lvalue or not?

Asked By: Interview Candidate | Asked On: Mar 6th, 2005

An lvalue was defined as an expression to which a value can be assigned. Is an array an expression to which we can assign a value? The answer to this question is no, because an array is composed of several separate array elements that cannot be treated as a whole for assignment purposes. The following...

Answered by: adarshjoshi on: May 12th, 2011

An object is a region of storage that can be examined and stored into. An lvalue is an expression that refers to such an object. An lvalue does not necessarily permit modification ...

Answered by: jbode on: Nov 30th, 2010

 Per the C Language Standard (hoping the posting software doesn't munge the following so that it's completely unreadable): ---------------------6.3.2.1 Lvalues, arrays, and function desig...

When is a switch statement better than multiple if statements?

Asked By: Interview Candidate | Asked On: Mar 6th, 2005

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

Answered by: jaspreet grewal on: Oct 13th, 2011

Simply saying, IF-ELSE can have values based on constraints
where SWITCH can have values based on user choice.

Answered by: Jegan Chakkravarthy on: Jan 7th, 2011

Switch statements can be used when any one of the given alternatives are to be matched. In the sense, only when an equality operator is needed. Other relational operators can't be used in switch c...

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us: