wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

সি প্রোগ্রামিং শিখো- with আব্দুর রাজ্জাক জনি

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What are the basic data types in C?

a)

int, float, double, char, void

b)

string, boolean, list, map, set

c)

char16, char32, byte, short, long

d)

int8, int16, int32, int64, float

2.

How do you declare an integer variable in C?

a)

char myVariable;

b)

float myVariable;

c)

double myVariable;

d)

int myVariable;

3.

What is the purpose of the printf function in C?

a)

To read input from the user.

b)

To perform mathematical calculations.

c)

To allocate memory for variables.

d)

To output formatted text to the console.

4.

How do you read input from the user in C?

a)

Use the 'scanf' function to read input from the user.

b)

Utilize the 'input' function for user input in C.

c)

Employ the 'getchar' function to capture user input.

d)

Use the 'printf' function to read input from the user.

5.

What is the formula to calculate the area of a triangle?

a)

Area = base * height

b)

Area = 1/3 * base * height

c)

Area = 1/2 * base * height

d)

Area = base + height

6.

Write a C program to calculate the area of a triangle given base and height.

a)

#include int main() { int base, height; printf("Base: "); scanf("%d", &base); printf("Height: "); scanf("%d", &height); printf("Area: %d\n", base * height); return 0; }

b)

#include int main() { float base, height, area; printf("Enter the base of the triangle: "); scanf("%f", &base); printf("Enter the height of the triangle: "); scanf("%f", &height); area = (base * height) / 2; printf("The area of the triangle is: %.2f\n", area); return 0; }

c)

#include int main() { float base, height; printf("Enter base: "); scanf("%f", &base); height = 5.0; float area = base * height; printf("Area: %.2f\n", area); return 0; }

d)

#include int main() { float base = 0, height = 0; printf("Base: "); scanf("%f", &base); printf("Height: "); scanf("%f", &height); printf("Area: %.2f\n", (base + height) / 2); return 0; }

7.

What is the formula to calculate the area of a circle?

a)

A = 2πr

b)

A = πd

c)

A = r²/2

d)

A = πr²

8.

Write a C program to calculate the area of a circle given the radius.

a)

#include #include int main() { double radius, area; printf("Enter the radius of the circle: "); scanf("%lf", &radius); area = M_PI * radius * radius; printf("Area of the circle: %.2f\n", area); return 0; }

b)

#include int main() { double radius, area; printf("Enter the radius of the circle: "); scanf("%lf", &radius); area = 2 * M_PI * radius; printf("Area of the circle: %.2f\n", area); return 0; }

c)

#include #include int main() { double radius; printf("Enter the radius of the circle: "); scanf("%lf", &radius); printf("Area of the circle: %.2f\n", radius); return 0; }

d)

#include int main() { float radius, area; printf("Enter the diameter of the circle: "); scanf("%f", &radius); area = radius * radius; printf("Area of the circle: %.2f\n", area); return 0; }

9.

What are control structures in C?

a)

Control structures in C are only 'if' and 'else'.

b)

Control structures in C include 'case', 'foreach', and 'repeat'.

c)

Control structures in C consist of 'try', 'catch', and 'finally'.

d)

Control structures in C include 'if', 'else', 'switch', 'for', 'while', and 'do-while'.

10.

Explain the difference between 'if' and 'switch' statements in C.

a)

The 'if' statement evaluates multiple variables, whereas 'switch' only checks one boolean expression.

b)

The 'if' statement is for conditional execution based on boolean expressions, while 'switch' is for selecting among multiple cases based on a single variable's value.

c)

The 'if' statement is used for looping through values, while 'switch' handles boolean conditions.

d)

The 'if' statement is for error handling, while 'switch' is for defining functions.

11.

What is a loop in programming?

a)

A loop is a control structure that repeats a block of code as long as a specified condition is true.

b)

A loop is a type of variable that holds a single value.

c)

A loop is a data structure that stores multiple values.

d)

A loop is a function that executes only once when called.

12.

Name the types of loops available in C.

a)

for, while, do while

b)

if, switch, case

c)

foreach, repeat until, loop until

d)

break, continue, return

13.

How do you write a for loop in C?

a)

for(int i = 0; i < n; i++) { // code to execute }

b)

for(i = 0; i < n; i++) { // execute code }

c)

for(int i = 1; i <= n; i++) { // run code }

d)

for(int i = n; i > 0; i--) { // perform action }

14.

What is an algorithm?

a)

An algorithm is a collection of unrelated tasks.

b)

An algorithm is a random guess for finding a solution.

c)

An algorithm is a step-by-step procedure for solving a problem.

d)

An algorithm is a single step to achieve a goal.

15.

How do you define a variable in C?

a)

To define a variable in C, use the syntax: ;

b)

To create a variable in C, write: is ;

c)

To declare a variable in C, use: ;

d)

In C, a variable is defined with: as ;

16.

What is a flowchart?

a)

A flowchart is a type of computer programming language.

b)

A flowchart is a method for writing essays.

c)

A flowchart is a tool for measuring time management.

d)

A flowchart is a diagram that represents a process or workflow.

17.

What are the basic symbols used in flowchart design?

a)

Basic symbols in flowchart design include: Oval (Start/End), Rectangle (Process), Diamond (Decision), Arrow (Flow Direction).

b)

Parallelogram (Subroutine)

c)

Hexagon (Loop)

d)

Circle (Input/Output)

18.

How do you represent a decision in a flowchart?

a)

A decision is represented by a square shape.

b)

A decision is represented by a triangle shape.

c)

A decision is represented by a diamond shape.

d)

A decision is represented by a circle shape.

19.

What is the purpose of a while loop in C?

a)

The purpose of a while loop in C is to execute a block of code repeatedly while a condition is true.

b)

The purpose of a while loop in C is to declare variables.

c)

A while loop in C is meant for error handling.

d)

A while loop in C is used to define a function.

20.

How can you use a do-while loop in C?

a)

Use a while loop in C by writing: while (condition) { // code };

b)

Implement a for loop in C using: for (initialization; condition; increment) { // code };

c)

Use a do-while loop in C by writing: do { // code } while (condition);

d)

Create a repeat-until loop in C with: repeat { // code } until (condition);