C language interview questions solution for freshers beginners placement tricky good pointers answers explanation operators data types arrays structures functions recursion preprocessors looping file handling strings switch case if else printf advance linux objective mcq faq online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c++ tutorials and pdf

what is the source code for a program that can be executed once and the file(the whole program) which have this code have to deleted from directory automatically?

recently i had written a c exam in which i got the following question :

“Hello World” can be written without semicolon

a) C89 b) C99 c) Cannot be done

i know this one way i which "hello world can be printed" by

if (prinf("hello world") but i am not sure whther it will work in c89 and c99 also, i jus tried in turbo c and it works. in this case what should be my answer for the above question.

2. Write a function that, given two dimensions entered from the keyboard, it should compute the area and perimeter/circumference, of three polygons – Square, Rectangle, and Circle.

I) Consider an array A of n integers (n constant). Write a program to: 1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below). 2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once. 3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant) Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

) Consider an array A of n integers (n constant). Write a program to: 1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below). 2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once. 3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant) Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

I have a text file: sample.txt, which is constantly being updated with data. I need to read this file constantly and update an excel spreadsheet with the data in this text file. Can anyone please help me with the program to do so?

write a c program to calculate area of perimeter of a right angled triangle witha,b,c where cis the hypothneus use formula c square =a squar+bsquare and area=0.5*(a*b)

hi, 1.wap to print a semicolon without using a semicolon anywhere in the code. 2.wap compare two strings without using strcmp() 3.wap concatenate two strings without using strcat() 4.wap delete a specified line from a text file 5.wap replace a specified line ina text file 6.wap to find the number of lines in a testfile

Can anyone help me write a source code that could print odd and even numbers between 1 and 50,odd in word and even in excel immediately because i am handing in the work tomorrow morning

Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))... For example, using 99, we get the sequence 99, 9*9 = 81, 8*1 = 8. You are expected to complete the function, getSingleDigitProduct, which takes a single argument. The argument passed to the function is an integer N. Your function is expected to return after how many steps a single digit number occurs in this sequence. please help me

## 71 comments:

what is the source code for a program that can be executed once and the file(the whole program) which have this code have to deleted from directory automatically?

how can i change the source code file name by compiling it?

what is the return type of Printf function??with Explanation????

recently i had written a c exam in which i got the following question :

“Hello World” can be written without semicolon

a) C89

b) C99

c) Cannot be done

i know this one way i which "hello world can be printed" by

if (prinf("hello world")

but i am not sure whther it will work in c89 and c99 also, i jus tried in turbo c and it works. in this case what should be my answer for the above question.

return type of printf() is int and it return number of character it print

what wil be the outputof following code

main(){

char p[]="%d\n";

p[1]='c';

printf(p,65);

}

Output of above code : A

2. Write a function that, given two dimensions entered from the keyboard, it should compute the area and perimeter/circumference, of three polygons – Square, Rectangle, and Circle.

Program to find out the following:

1^2/1!+2^2/2!+3^2/3!+4^2/4!+……………………………..……. n^2/n! terms.

please anyone help...

What would be the program for this one?

1.2/3+2.3/4+3.4/5+…………………………………..n terms.

x=0;

while(x<10)

{printf("%d",x);

x++;

}

change it into do while loop

In do while loop

x=0;

do{

if(x<10){

prinf("%d",x);

x++;

}

}

while(x<10);

WAP TO CODE THE FOLOWNG OUTPUT:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4 5 6 7 8

#include

#include

struct xyz

{

int x;

char a[2];

}e;

void main()

{

e.x=512;

printf("%d",e.x);

printf("%d",e.a[0]);

printf("%d",e.a[1]);

getch();

}

what will be the output and why....?????

WAP TO CODE THE FOLOWNG OUTPUT:

1

1 2

1 2 3

1 2 3 4

1 2 3 4 5

1 2 3 4 5 6

1 2 3 4 5 6 7 8

Solution:-

int i,j,k=1;

for(i=1;i<=8;i++)

{

for(j=1;j<=i;j++,k++)

printf("%d",k);

printf("\n");

}

Can you help me solve these two problems:

I) Consider an array A of n integers (n constant).

Write a program to:

1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below).

2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once.

3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant)

Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

wap a program that accept a positive integer N(1<=N<=15).

input=5

output:

1 * * * * * * * * * 1

1 4 * * * * * * * 1 2

1 4 9 * * * * * 3 5 8

1 4 9 6 * * * 3 1 4 5

1 4 9 6 5 * 9 4 3 7 0

) Consider an array A of n integers (n constant).

Write a program to:

1- fill an array B (of at most n integers) by the number of elements in each ascending sequence in A (see the example below).

2- fill an array C (of at most n/2 integers) by the number of occurrences of each value in B. Note that each value in B is to be considered once.

3-display the total number of ascending sequences and the total number of sequences of different sizes

II) Consider an array T of n integers (n constant)

Write a program to sort the even elements and sort the odd elements of T by ascending order, depending on the min of T : if the min is even, even elements must be sorted first, otherwise, odd elements will start the aray.

I have a text file: sample.txt, which is constantly being updated with data. I need to read this file constantly and update an excel spreadsheet with the data in this text file. Can anyone please help me with the program to do so?

1 * * * * * * * * * 1

1 4 * * * * * * * 1 2

1 4 9 * * * * * 3 5 8

1 4 9 6 * * * 3 1 4 5

1 4 9 6 5 * 9 4 3 7 0

hw to copy and paste a function from one file to another file??

i have tried using cretng header files .h eg. #include "genrte.h"................ but i think thrgh this come prblm is cmng...plz help

what is storage class,what is the use of it,pls

explain with example

In representation of floating point numbers when we take LSB 1(although when it is 0 )?

What is structure padding ?explain with example

can we print any message in 'c' without using semicolon?

yes we can write the message without using any semicolon:

Solution: 1

void main(){

if(printf("Hello world")){

}

}

Solution: 2

void main(){

while(!printf("Hello world")){

}

}

Solution: 3

void main(){

switch(printf("Hello world")){

}

}

#include #include void quiz(int w); main() { int x= 5; clrscr(); quiz(5); } void quiz(int w) { if(w>1) { quiz(w/2); quiz(w/2); } printf("*"); }

please explain how it works

void quiz(int w); main() { int x= 5; clrscr(); quiz(5); } void quiz(int w) { if(w>1) { quiz(w/2); quiz(w/2); } printf("*"); }

output

1

22

333

4444

55555

write a c program to simulate a rational data type in c

write a c program to calculate area of perimeter of a right angled triangle witha,b,c where cis the hypothneus use formula c square =a squar+bsquare and area=0.5*(a*b)

main(){

char p[]="%d\n";

p[1]='c';

printf(p,65);

}

Ans is:A

void main()

{

int arr[10]={1,2,3,4,1,2,3,5,6,7};

int asize=sizeof(arr)/sizeof(arr[0]);

int i,j;

clrscr();

for(i=0;i<asize;i++){

for(j=(i+1);j<asize;j++)

{

if(arr[j]-arr[j+1]==0)

{

printf("\nThe Duplicate Array is:%d",arr[j]);

}

}

}

getch();

}

function()

{

printf(" Hello World");

}

How to define this function to get the output "Hello world" without calling the function in main()

but how to create an algorithm for second largest number of a list of numbers given by the user.

Does Sequence In matter In Structures?

Ex;

Struct exp{

void *data;

int num;

}

and

struct exp{

int num;

void *data;

}

Hi guys whats the C code for checking whether a user has entered a number twice and display an error message

thnx

how to write a C++ program showing the highest integer among three given integers using IF condition 6 times?

hi,

1.wap to print a semicolon without using a semicolon anywhere in the code.

2.wap compare two strings without using strcmp()

3.wap concatenate two strings without using strcat()

4.wap delete a specified line from a text file

5.wap replace a specified line ina text file

6.wap to find the number of lines in a testfile

Go through following links:

http://cquestionbank.blogspot.com/2011/09/c-program-to-print-hello-world-without.html

http://cquestionbank.blogspot.com/2011/09/how-to-compare-two-strings-in-c-without.html

http://cquestionbank.blogspot.com/2011/09/string-concatenation-in-c-without-using.html

write a program to capture the prime numbers between 0 and 40

nice questions

i want to get even numbers by addition or subtraction in c programmimn

please tell me

my e id singhaniyanrajesh2@gmail.com

hi

pls explain how it work

a=5,b=10;

a=a^b;

b=a^b;

a=b^a;

printf("%d%d",a,b);

Can anyone help me write a source code that could print odd and even numbers between 1 and 50,odd in word and even in excel immediately because i am handing in the work tomorrow morning

#include

#include

int main()

{

int i,j;

for(i=0;i<8;i++)

{

for(j=0;j<i;j++)

{

printf("%d",j);

}

printf("\n");

}

getch();

return 0;

}

#include

#include

int main()

{

int i,j;

for(i=0;i<=5;i++)

{

for(j=0;j<i;j++)

{

printf("%d",i);

}

printf("\n");

}

getch();

return 0;

}

Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))...

For example, using 99, we get the sequence 99, 9*9 = 81, 8*1 = 8.

You are expected to complete the function, getSingleDigitProduct, which takes a single argument. The argument passed to the function is an integer N. Your function is expected to return after how many steps a single digit number occurs in this sequence.

please help me

Good information. needs to be arranged in a better way.

sir, please upload the c programme for tic tac toe game...

this is another way to print "hello world "

while(!printf("hello world")){}

Could you tell me what would be the code for this output

10 1 9 2 8 3 7 4 6 5 5 6 4 7 3 8 2 9 1 10

Yes....it's Workling........

write a program which produce the given sequence number using the 3 looping statement

output 5,1,4,2,3,3,2,4,1,5,

help me plzzzzz :(

im waiting ^_^

How to print using recursion the following

*

**

***

****

*****

? Thanks

switch(printf("hello world")){}

p[1] = c overwrite the second element of array P by c. so array p becomes %c.

printf(p,65) it prints the ASCII value of 65

so output is A

if(printf("hai")){ }

Program to convert given number to words....(upto 10 digits)

for example...

input :12345

output :twelve thousand three hundred forty five...

How to write the algorithm for switch statement in C?

yes..

We create another copy of file when compile the source code and change old file name.

how to write c program multiply octal and hexadecimal numbres

c program to print ur address

Use file.bat lines in it are call program.exe del program.exe

Mobile app development company in mumbai

mobile app development company in delhi

Post a Comment