GeekInterview.com
Series: Subject: Topic:

Programming Interview Questions

 
Sub Categories (+ View)
Subject Name
Questions
Answers
Last updated
52
229
Sep
18th,
2014
65
220
May
30th,
2014
98
476
Jun
29th,
2014
24
46
Sep
11th,
2014
63
76
Jul
24th,
2014
46
123
Jul
31st,
2012
Showing Questions 1 - 20 of 37 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

Write a program to read a four digit integer and print the sum of its digits.Write a program that reads a floating point number and then displays the right-most digit of the integral part of the number.

Asked By: rishi | Asked On: Oct 21st, 2007

Answered by: gaurav kumar jaiswal on: Aug 31st, 2014

Write a c++ program to the sum and product of digits of an integers

Answered by: karuna gaur on: Apr 15th, 2013

456 sum is 15

Code
  1. int sumDigits(int n) {
  2. int sum = 0;
  3.  
  4. while( n > 0 ) {
  5. sum += (n % 10); // add last digit of n to sum
  6. n /= 10; // divide n by 10 to "chop off" the last digit
  7. }
  8.  
  9. return sum;
  10.  
  11. getch();
  12. }

Functions

Asked By: pokhara | Asked On: Apr 15th, 2013

1.One foot equals 12 inches. Design a function named feettolnches that accepts a number of feet as an argument, and returns the number of inches in that many feet. Use the function in a program that prompts the user to enter a number of feet and then displays the number of inches in that many feet. 2.Rainfall...

Answered by: George on: Jul 29th, 2014

In Haskell (please excuse syntax highlighting; they dont have it for this language):"css -- feetToInches.hs module Main where feetToInches :: Num a => a -> a feetToInches = (*12) ...

Logic and design

Asked By: pokhara | Asked On: Apr 15th, 2013

Number analysis program design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: • the lowest number in the array • the highest number in the array • the total of the numbers in the array • the...

Answered by: tnguyen25 on: Jun 2nd, 2014

Thank you for your question. "c# private static int lowestNumberInArray(int[] numbers) { if (numbers.Length < 0) throw new ArgumentExce...

Analysis number design flow chart

Asked By: pokhara | Asked On: Apr 17th, 2013

Number analysis program design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: the lowest number in the array,the highest number in the array and the total of the numbers in the array...

Answered by: Michael Brown on: Apr 1st, 2014

"c numlist = [-7,1,2,45289, 7,5,9,7,4,-10,34,234345678,32,12,1566,0,8,5,4,2] sum = 0 current = numlist[0] high = numlist[0] low = numlist[0] current = numlist[0] for i in rang...

Arrays

Asked By: pokhara | Asked On: Apr 17th, 2013

Design a flow chart for program that displays the number of days in each month. The program should have two parllel arrays 12 element string array that is initialized with the names of the month, and 12 element integer array that is initialized the number of days in each month.

Answered by: Cassandra Blackburn on: Sep 9th, 2013

Jan Month have 31 Days Feb Month have 28 days March Month have 31 Days April Month have 30 Days
May Month have 31 days June Month have 30 Days July Month have 31 days Aug Month have 31 Days
Sept Month have 30 Days Oct Month have 31 Days Nov Month have 30 days Dec Month have 31 Days

Answered by: Ponni Vaithiyanathan on: Aug 20th, 2013

Jan Month have 31 Days feb Month have 28 Days March Month have 31 Days April Month have 30 Days May Month have 31 Days June Month have 30 Days july Month have 31 Days Aug Month have 30 Days sep Month ...

Career guidance

Asked By: neetu tiwari | Asked On: Apr 22nd, 2013

I m doing mca n m in 2nd semester. I want to have an experience abt my job. There are no software companies here, how can I experience abt the jobs related to my field...Any kind of internship which I can do while staying here..Pls guide me mam.

Flow

Asked By: pokhara | Asked On: Apr 17th, 2013

Number analysis program design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: the lowest number in the arraythe highest number in the array the total of the numbers in the arraythe...

Efficient algorithm to print count and possible string outcomes of a given input string

Asked By: taru22 | Asked On: Apr 27th, 2012

Write an efficient algorithm to print count and possible string outcomes of a given input string by retaining order and considering all characters during this process problem: given a input string as "0000" and following input scheme for the zeroes, print the possible outcomes by retaining order of...

Answered by: cfphpflex@gmail.com on: Mar 21st, 2013

1. get string length 2. print length 3. for string 0000, its easy: 4. look at 0000 and quickly understand that each 0 in the string can only have 3 other possible 0 s to compare against and get a diff...

=0;$i--) { $rstr.=$str[$i]; } echo $rstr;{/geshibot} It work but I want to know why we use .dot(.) $rstr.=$str[$i]; over here thanks in advance" href="http://www.geekinterview.com/question_details/88615">Reverse a sting using loop in PHP

Asked By: navin3434 | Asked On: Nov 19th, 2012

Hi , when I reverse a string using loop in php like

Code
  1. $str="navin";
  2.  $rstr="";
  3.  $len=strlen($str);
  4. for($i=$len-1;$i>=0;$i--)
  5. {
  6. $rstr.=$str[$i];
  7. }
  8. echo $rstr;
It work but I want to know why we use .dot(.) $rstr.=$str[$i]; over here thanks in advance

Answered by: Emiliano Gaytan on: Mar 21st, 2013

to concat, . operator concats left & right values; Google it for more info "php $myVar = 2; // declare variable in php print_r($myVar . ""); //print on screen your variable w htm...

If else in C++

Asked By: Seniorija | Asked On: Oct 22nd, 2012

Hi guys , in C++ programming (if) when we use "=" isntead of "==" compiler behave the same ... Do u know why compiler behave like this ?? tnx

Answered by: vinodh on: Dec 11th, 2012

In the first if condition want to place double equal.then it will treat as condition.otherwise it will treat as declaration

Answered by: krish3636 on: Oct 26th, 2012

C++ compiler treat Zero(0) as false and all nonzero value as true.
Consider the case 1:
if(val=20) //implicitly it becomes if(20)
{
cout

Print sum of digits

Asked By: ayongying | Asked On: May 28th, 2010

Write a function to print sum of the digits in a given integer n without converting it to string. For example : if n = 1234 the function should return 1+2+3+4 = 10 if n = 15 the function should return 1+5 =6 if n = 5 the function should return 5.

Answered by: jenisha on: Jul 1st, 2012

"c #include main() { int n, sum = 0, remainder; printf("Enter an integer "); scanf("%d",&n); while(n != 0) { remainder = n % 10; sum = sum + remai...

Answered by: brajeshupd on: Jun 13th, 2012

"c #include #define MIN_REMAINDER 0 /* For checking the number */ int findSum(int); /* recursive function to find the Sum */ main() { int num = 1,sum...

Web table is not being recognized..!!

Asked By: dmreddy | Asked On: May 1st, 2012

What if there are two web tables in a web page and if add those web tables into or it is not being added, what will be the solution if we have to work on those web tables then?

Timer sharing and batch processing

Asked By: witty genius | Asked On: Feb 9th, 2011

What are the advantages and dis-advantages of real time, timer sharing and batch processing?

Generate no.Between 32 to 99

Asked By: mounik | Asked On: Oct 26th, 2011

Consider the following number 45*45=2025 and 20+25=45. write a program to generate no.Between 32 to 99 that satisfy the above problem.

Answered by: mahamadalig on: Apr 17th, 2012

Code
  1. #include<stdio.h>
  2. #include<conio.h>
  3. main()
  4. {
  5.         int i,a,r,s,w;
  6.         printf("                ------ANSWER IS:---------
  7. ");
  8.         for(i=32;i<=99;i++)
  9.         {
  10.                 s=0;
  11.                 w=i;
  12.                 a=i*i;
  13.                 while(a>0)
  14.                 {
  15.                         r=a%100;
  16.                         s=s+r;
  17.                         a=a/100;
  18.                 }
  19.                 if(w==s)
  20.                 {
  21.                         printf("                           %d
  22. ",w);
  23.                 }      
  24.         }
  25.         return 0;
  26. }

Tell about shell aritmetic operators and functions.

Asked By: santhoshkumar | Asked On: Oct 23rd, 2007

Answered by: suji on: Mar 2nd, 2012

There are following shell operators

Arithmetic Operators.

Relational Operators.

Boolean Operators.

String Operators.

File Test Operators.

Samba attributes

Asked By: abhidepali | Asked On: May 13th, 2009

What are the attributes of samba?

Answered by: suji on: Mar 2nd, 2012

Here are the samba attributes sambaLMPassword sambaNTPassword sambaPwdLastSet sambaAcctFlags sambaLogonTime sambaLogoffTime sambaKickoffTime sambaPwdCanChange sambaPwdMustChange sambaHomeDrive samb...

Cass to track number of instances

Asked By: ayongying | Asked On: May 28th, 2010

Design a class that will keep track of number of instances that have been instantiated. Make this class thread safe.

Answered by: Dearsi on: Feb 1st, 2012

Here

Code
  1. 1       public class Utility
  2. 2       {
  3. 3           public Utility()
  4. 4           {
  5. 5               InstanceCount++;
  6. 6           }
  7. 7        
  8. 8           public static int InstanceCount;
  9. 9       }

How to write spiral matrix program?

Asked By: Swati | Asked On: Feb 6th, 2007

Answered by: ashoknaina on: Dec 20th, 2011

Code
  1. #include<stdio.h>
  2. main()
  3. {
  4. int a[20][20],i,j,n,m,p,q,k=0;
  5. Enter Order Of matrix");
  6. scanf("%d%d",&m,&n);
  7. for(i=1;i<=m;i++)
  8. for(j=1;j<=n;j++)
  9.     scanf("%d",&a[i][j]);
  10.  
  11. p=m;
  12. q=n;
  13. i=j=1;
  14.  
  15. while(k<p*q)
  16. {
  17.     for(;j<=n&&k<p*q;j++)
  18.     {
  19.         printf("%d ",a[i][j]);
  20.         k++;
  21.     }
  22.     j--;  
  23.     i++;
  24.     for(;i<=m && k<p*q;i++)
  25.     {
  26.         printf("%d ",a[i][j]);
  27.         k++;
  28.     }
  29.     i--;
  30.     j--;    
  31.     for(;j>=i-m+1 && k<p*q;j--)
  32.     {
  33.         printf("%d ",a[i][j]);
  34.         k++;
  35.     }    
  36.     j++;
  37.     i--;
  38.     for(;i>1 && k<p*q;i--)
  39.     {
  40.         printf("%d ",a[i][j]);
  41.         k++;
  42.     }
  43.     if(k<p*q)
  44.     {
  45.         j++;
  46.         i++;
  47.         n--;
  48.         m--;
  49.     }
  50. }
  51. }

Answered by: Abhijit Singh on: Apr 27th, 2007

/*~~~~~~~~~ Creates square and  rectangular matrices ~~~~~~~~*//* Input required is dim of the spiral matrix. Just feed in two factors of the size of array. i.e If Items are 35 then m = 5 n ...

Case sensitive

Asked By: jitubaba10 | Asked On: Jan 30th, 2008

Why the programing language are case sensitive as is not for user friendly.

Answered by: ashoknaina on: Dec 19th, 2011

Yes th programming language is case sensitive because of its sensitivity that means the language itself having some built in keywords that are used to define variables and data types also vary accordi...

Answered by: lavanyats on: Jul 27th, 2008

When a PL is case sensitive, the number of possible keywords/ variable names permissible is increased. Also - more important reason - program readability is improved - we use caps for macros, have different naming conventions based on case sensitivity and so on.

Interface in c#

Asked By: dimplesharma | Asked On: Oct 14th, 2010

If the interface in c# only contains the declaration of the methods and we need to define those methods in the class, then why we use the interface..???

Answered by: TheOutlander on: Jan 2nd, 2011

Interfaces define a contract. You should use it only if you want to support a group or related functionalities in a class or struct. Otherwise there is no need to use it. Think about cars - they have ...

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Question Categories

Algorithm Questions

ColdFusion Interview Questions

Computer Awareness Questions

Delphi Interview Questions

Perl Interview Questions

PHP Interview Questions

Python Interview Questions

VBA Interview Questions

VoiceXML Interview Questions

XML Interview Questions

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.