0% found this document useful (0 votes)
2 views2 pages

Practice Questions

The document contains a series of short and broad questions related to C programming, including definitions, code outputs, error identification, and programming tasks. It covers topics such as arrays, loops, control structures, and basic algorithms. Additionally, it asks for comparisons and explanations of programming concepts.

Uploaded by

soumya271005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Practice Questions

The document contains a series of short and broad questions related to C programming, including definitions, code outputs, error identification, and programming tasks. It covers topics such as arrays, loops, control structures, and basic algorithms. Additionally, it asks for comparisons and explanations of programming concepts.

Uploaded by

soumya271005
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Short Questions

1. Define an array.
2. Find the output
for(i=0;i<=10;i++);
printf(“%d”,i);
3. a = 1>2 ? 3 : 4; printf(“%d” , a); What will be the output ?
4. Find the output
int a=4.5;
printf(“%d”,a);
5. Find the error in the following code:
int arr[5] = {1, 2, 3};
printf("%d", arr[5]);
6. Find the output
int a = 5, b = 10;
printf("%d", !(a == b) || (b > a));
7. The do-while loop is a/an ____________________ controlled loop.
8. What is the output?
int arr[] = {1, 2, 3, 4, 5};
printf("%d", arr[2]);
9. Find the output
int x = 10;
if (x = 5) {
printf("True");
} else {
printf("False");
}
10. State the error in the following statement:
int 1a = 5;
11. Find the output:
char arr[2] = {‘A’,’B’};
printf(“%d”, arr[1]);
12. What is the output?
int x = 7, y = 4, z = 5;
printf("%d", x == y || z > y);

Broad questions

1. Write a C program to print the day of the week based on user input
(e.g., if the input is 1 then the output will be Monday).
2. Write a C program to display the following pattern:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
3. Write a C program to display the following pattern:
1
2 3
4 5 6
7 8 9 10
4. Write a C program that takes a list of integers from the user and
prints the maximum and minimum numbers.

5. Define algorithm and its properties. Distinguish it from Flowchart.


6. Write a program to check whether a user given number is prime or
composite.

7. Write a program to generate the Fibonacci series up to a number of


terms given by the user.
8. Compare for, while, and do-while loop with suitable examples.
9. Write a program to find the sum of the elements of an array of size
10.
10. Distinguish between Compiler and Interpreter with examples.
11. Explain the main components of a computer system with a neat
diagram.
12. Write a program to check whether a use given integer is a
palindrome.

You might also like