Basic C language programs for technical interview questions

Basic C language programs for beginners for an interview with answers

Hello, students today I am listing over some C language basic programs that are asked in interviews with solutions for beginners like you who are reading this article now. Basic C language programs for beginners interview.

Here some C program code examples with output are listed four your question that you come across more often “what are the basic c programs”

First of all we have to understand “basic c programs syntax” how we write the c program structure.

Basic C language programs for beginners interview questions

List of basic c programs asked in an interview – basic c programs list

Q1. Write a C program to display “hello world”?

Answer code solution:

#include <stdio.h>
int main() {
   // printf() is an built-in function used to display the string
   printf("Hello, World!");
   return 0;
}
Output : Hello, World!

Q2. Write a basic c programs for leap year? (program to check leap year)

Answer code solution:

#include <stdio.h>
int main() {
   int year;
   printf("Enter a year: ");
   scanf("%d", &year);

   // leap year if perfectly visible by 400
   if (year % 400 == 0) {
      printf("%d is a leap year.", year);
   }
   // not a leap year if visible by 100
   // but not divisible by 400
   else if (year % 100 == 0) {
      printf("%d is not a leap year.", year);
   }
   // leap year if not divisible by 100
   // but divisible by 4
   else if (year % 4 == 0) {
      printf("%d is a leap year.", year);
   }
   // all other years are not leap year
   else {
      printf("%d is not a leap year.", year);
   }

   return 0;
}
Output 1 :
Enter a year: 2013
2013 is not a leap year.

Output 2 :
Enter a year: 2020
2020 is a leap year.

Q3. Write a basic c programs to check given no is prime number or not?

Answer code solution:

#include <stdio.h>
int main() {
    int n, i, flag = 0;
    printf("Enter a positive integer no: ");
    scanf("%d", &n);

    for (i = 2; i <= n / 2; ++i) {

        // condition to check non-prime
        if (n % i == 0) {
            flag = 1;
            break;
        }
    }

    if (n == 1) {
        printf("1 is neither prime nor composite number.");
    }
    else {
        if (flag == 0)
            printf("%d is a prime number.", n);
        else
            printf("%d is not a prime number.", n);
    }

    return 0;
}
Output :
Enter a positive integer: 7
7 is a prime number.

Enter a positive integer: 10
10 is not a prime number.

Q4. Demonstrate if-else loop using basic c programs code

Q5. Write basic c programs on loops? (eg do-while, while, nested for loops.. etc..)

Q6. Execute basic c programs on the sum?

Q7. Write a basic c program on demonstration of arrays?

Q8. Write basic c programs to print fibonacci series?

Q9. Write basic c programs on functions?

Q10. Write basic c programs on pointers?

Q11. Code for Basic C programs using structures?


Q12. Write a program in C to Pass arrays to a function?

Q13. Write a c program using string handling functions?


Q14. Write basic c programs using switch conditional statements?

Q15. Basic C programs to display pyramids and patterns(eg floyd’s triangle, number series, stars pattern etc)

Basic C programs pdf

If you demand then I will definitely provide you the pdf file for C language basic program questions with answers that could help you while appearing big fortune 500 MNCs like Accenture, Wipro, Capgemini, Infosys, Cognizant, Tata Consultancy Services(TCS) and many more.

Also Read C programming Important practical program questions

Basic C language programs for beginners technical interview session

Basic c programs asked in tcs interview


Basic c programs asked in Wipro interview


Basic c programs asked in Infosys interview

c interview programs, c language basic programs, basic c programming questions, basic c programs algorithms

Also Refer to this basic c programs basic tutorial notes for beginners

Basic C Programs mcq

  1. What is C?
  2. What approach does C programming follow?
  3. When C Programming invented
  4. Prior language to C
  5. In which year did the C language got invented?

There are many much more basic c programs questions and answers you will find on the internet for your knowledge and basic c programs to practice.

Also Read Top 50 Interview questions for computer science students

Leave a Comment

Your email address will not be published. Required fields are marked *

error: