Programming Interview Questions

Sub Category
Questions
Last Updated
60
267
Nov 27th, 2018
23
37
Jul 14th, 2017
26
41
Apr 5th, 2018
27
29
Jul 25th, 2017
66
248
May 21st, 2018
101
523
Mar 26th, 2018
25
86
Sep 11th, 2018
63
78
Nov 22nd, 2017
21
27
Apr 27th, 2017
46
125
Feb 3rd, 2016

Showing Questions 1 - 20 of 25 Questions
First | Prev | Next | Last Page
Sort by:
|
•

Logic and Design

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 average of the numbers in the array

Teja

• Oct 8th, 2017

int arr[] = {4,2,6,1,7,12,10,11}; int min= arr[0]; int max= arr[0]; int total = 0; int avg; for(int i=0; i arr[i]) { min = arr[i]; } else if(max < arr[i]) { max = arr[i];...

Shubhangi

• Oct 5th, 2017

I inserted a code but how to get exact decimal point answer for avg,I didnt get .

```Code#include<stdio.h>
main()
{
int arr[10];
int i,size;
size=sizeof(arr)/sizeof(arr[0]);
printf("enter the array elemrnt......
");

for(i=0;i<size;i++)
//scanf("%d",&arr[i]);
arr[i]=rand()%100;

for(i=0;i<size;i++)
printf("%d      ",arr[i]);
printf("
");

//lowest number....
int temp=arr[0];
for(i=1;i<size;i++)
{
if(temp>arr[i])
temp=arr[i];
else
continue;
}
printf("lowest element=%d
",temp);
//highewst numer
temp=arr[0];
for(i=1;i<size;i++)
{
if(temp<arr[i])
temp=arr[i];
else
continue;
}
printf("highest element=%d
",temp);

//toatal of numbers
int sum =0;
for(i=0;i<size;i++)
{
sum=sum+arr[i];
}
printf("total of an array:%d
",sum);
//average
int avg;
avg=sum/size;
printf("average=%d
",avg);

}
```

•

Print Sum of Digits

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.

sravani reddy

• Sep 21st, 2017

```Code#include<stdio.h>
int main()
{
int rem,sum=0,n;
printf("enter the number:");
scanf("%d
",&n);
while(n!=0)
{
rem=n%10;
sum=sum+rem;
n=n/10;
}
printf("the sum of digits of a number is %d",sum);
return 0;
}```

Shasan

• Mar 29th, 2016

"c# public static int Sum() { int n = 1235678; int n1 = 0; int f = 0; while (n!= 0) { ...

•

Generate no.between 32 to 99

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.

gyanendra verma

• Aug 20th, 2017

"c #include void main() { int n1,n2,i,temp,b,j,c,check,count=0,a[4]; clrscr(); printf("enter starting number: "); scanf("%d",&n1); //n1=32 printf("enter ending number: "); ...

anonymous

• Apr 5th, 2017

Basically the same, but in node :)

```Codevar desired = [];
for(var i = 32; i <= 99; i++) {

var value = i * i;
var split1 = parseInt(value / 100);
var split0 = value % 100;
if(split1 + split0 == i) {
desired.push(i);
}
}

console.log("Desired values: " + desired);```

•

Secure Language

Which Language is more secure - Java or C?

Stefan Alenius

• Jun 7th, 2017

The language does not matter as much as the developers involved. Yes, there is a difference between the languages, just as it is a difference between a monkey wrench and a screwdriver, but both are ju...

turnball

• Apr 28th, 2016

Bad question really since you can write horribly insecure software under each but if all things are considered equal then Id say C is more inherently "secure." Still a bad question since you can write some spotty product in either language.

•

Flow

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...

Lohitha

• Jul 30th, 2016

```Code#include<stdio.h>
int main()
{
int a[20],i,min,max,count=0;
printf("enter elements into array:");
for(i=0;i<20;i++)
scanf("%d",&a[i]);
min=a[0];
for(i=0;i<20;i++)
{
if(a[i]<min)
min=a[i];
}
max=a[0];
for(i=0;i<20;i++)
{
if(a[i]>max)
max=a[i];
count++;
}
printf("minimum value is:%d
",min);
printf("maximum value is:%d
",max);
printf("Number of elements in an aray:%d
",count);
return 0;

}```

•

Functions

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 Statistics
Design a program that lets the user enter the total rainfall...

Sunil shenoy

• May 16th, 2016

```Code#include<iostream>
using namespace std;
float ft_to_inch(float ft)
{
return ft*12;
}
main()
{
float f,i;
cout<<"Enter a Feet value:"<<endl;
cin>>f;
i=ft_to_inch(f);
cout<<"result in Inches: "<<i<<endl;
}```

George

• 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) ...

•

Solve this Programming Task in language of preference

Imagine a customized computer keyboard with following layout :
ERTYU1
DFGHJ2
CVBNM4

The keyboard only has above set of keys in the panel , For a given set on input word you need to output the path taken to press them , for example :
Consider the input word is : RFGM
the output...

prasobh

• Jan 20th, 2016

#Python solution # E R T Y U 1 # D F G H J 2 # C V B N M 4 #NJUE2C1M keys=[E,R,T,Y,U,1,D,F,G,H,J,2,C,V,B,N,M,4] key_board_width = 6 str...

S VISHNUVARDHAN

• Aug 14th, 2015

"cpp #include using namespace std; #include #include char answer[5]; char a[4][7] = {"ERTYU1","DFGHJ2","CVBNM4 ; class trace { //protected: char input[100]; pu...

•

gaurav kumar jaiswal

• Aug 31st, 2014

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

karuna gaur

• Apr 15th, 2013

456 sum is 15

```Codeint sumDigits(int n) {
int sum = 0;

while( n > 0 ) {
sum += (n % 10); // add last digit of n to sum
n /= 10; // divide n by 10 to "chop off" the last digit
}

return sum;

getch();
}```

•

Analysis Number Design Flow chart

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...

Michael Brown

• 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

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.

Cassandra Blackburn

• 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

Ponni Vaithiyanathan

• 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 ...

•

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

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 the characters. input scheme: a "0" b "00" c "000" d "0000" example: "aaaa" is one string...

cfphpflex@gmail.com

• 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...

•

Reverse a sting using loop in php

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

php\$str="navin";
\$rstr="";
\$len=strlen(\$str);
for(\$i=\$len-1;\$i>=0;\$i--)
{
\$rstr.=\$str[\$i];
}
echo \$rstr;

It work but I want to know why we use .dot(.) \$rstr.=\$str[\$i]; over here thanks in advance

Emiliano Gaytan

• 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++

Hi guys ,

in c++ programming (if) when we use "=" isntead of "==" compiler behave the same ... Do u know why compiler Behave like this ??

Tnx

vinodh

• 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

krish3636

• 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

•

Samba Attributes

What are the attributes of Samba?

suji

• 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

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

Dearsi

• Feb 1st, 2012

Here

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

•

ashoknaina

• Dec 20th, 2011

```Code#include<stdio.h>
main()
{
int a[20][20],i,j,n,m,p,q,k=0;
printf("
Enter Order Of matrix");
scanf("%d%d",&m,&n);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
scanf("%d",&a[i][j]);

p=m;
q=n;
i=j=1;

while(k<p*q)
{
for(;j<=n&&k<p*q;j++)
{
printf("%d ",a[i][j]);
k++;
}
j--;
i++;
for(;i<=m && k<p*q;i++)
{
printf("%d ",a[i][j]);
k++;
}
i--;
j--;
for(;j>=i-m+1 && k<p*q;j--)
{
printf("%d ",a[i][j]);
k++;
}
j++;
i--;
for(;i>1 && k<p*q;i--)
{
printf("%d ",a[i][j]);
k++;
}
if(k<p*q)
{
j++;
i++;
n--;
m--;
}
}
}```

Abhijit Singh

• 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

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

ashoknaina

• Dec 20th, 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...

lavanyats

• 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#

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..???

TheOutlander

• 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 ...

•

Command Line Arguments

What is Command Line Arguments?What are its uses?Where we have to use this?

Abidullah

• May 21st, 2010

Command line arguments are used to provide input through console to the main function. The inputs values generally store into a string array (usually args[])Example:void main (String args[]){for ...

abhishekrane

• Dec 9th, 2008

Command line arguments are those which can be passed to the main method as parameters and use those values in the main method before executing it.

Showing Questions 1 - 20 of 25 Questions
First | Prev | Next | Last Page
Sort by:
|