Suppose input is “Welcome to gyantoday” then output should be “gyantoday to welcome” Steps of algorithm: Reverse whole sentence first.
Category: Most Important Interview Questions In C
Most important and frequently asked C interview questions
Q13. Write a C program to reverse a word.
Also interviewer can ask to write a C program to reverse a string. In below program we give input “welcome
Q12. Write a program to print diagonal element of an N*N matrix.
Lets take a matrix of 4*4 i.e. int matrix [4][4]; 11 12 13 14 21 22 23 24 31
Q11. How to generate fibonacci sequence up to given nth number?
First we should know what fibonacci sequence is: The Fibonacci Sequence is the series of numbers: 0, 1, 1, 2, 3, 5, 8, 13,
Q10. How to fast multiply a number by 4?
Bitwise operations are slightly faster than addition and subtraction operations and usually significantly faster than multiplication and division operations. Because
Q9. Write a C program to swap two variables without using any temporary variable.
It is easy to swap two variables by using a temp variable, but question is slightly different. Method 1: x
Q8. How to add two numbers without using plus operator?
We can add two numbers without using plus operator, many of us quickly reply with below answer. a – (-b)
Q7. How to find in one line whether a given number is power of 2 or not?
It seems difficult question for them, who have encountered these type of earlier. This type of question checks your understandings
Q6. Write a C program to convert a decimal number into a binary number system.
I am sure we all know about number system, still I would like to explain about binary and decimal number
Q5. Find the size of structure without using sizeof() operator.
To find size of a structure. We can use a pointer as we know if we increment structure pointer by
Q4. Write a program to print numbers from 1 to 100 without using loops.
There is nothing tough to write this program, only trick should click in your mind at time of program. I
Q3. Write a C program to check given number is palindrome or not ?
Also Interviewer can ask to you, write a C program to check given string is palindrome or not? Palindromes are
Q2. Write a C program to calculate power of a number (x,y).
There may be multiple method to calculate power of a number. Method 1: Using function recursion #include<stdio.h> int power(int a, unsigned
Q1. Find the factorial of a given number using recursion
Generally these type of question ask, to check your knowledge of function recursion. Given below C program to find factorial