0% found this document useful (0 votes)
15 views

P.K.R. Arts College For Women: (Autonomous) Gobichettipalayam - 638 475

Uploaded by

m.subashini2717
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

P.K.R. Arts College For Women: (Autonomous) Gobichettipalayam - 638 475

Uploaded by

m.subashini2717
Copyright
© © All Rights Reserved
Available Formats
Download as XLSX, PDF, TXT or read online on Scribd
You are on page 1/ 16

P.K.R.

Arts College for Women


(Autonomous)
Gobichettipalayam - 638 475
MCQ 2024-2025
WRITE-UP SHEET
Program: BCA & BSC(IT) & B.Sc(CS) Branch: COMPUTER SCIENCE

Course Code No. 24CSU01/24ITU01/24CAU01 Title of the Course/Subject: PROGRAMMING IN C

K1: Remember Level: (To assess whether the student could remember or Recall the facts, terms, basic concepts
the lesson learned.) Refer guidelines to set QPs.

Who is known as the creator of the C programming language?


A) Bjarne Stroustrup
B) Dennis Ritchie
1 C) James Gosling
D) Ken Thompson

Which data type is used to store a single character in C?


A) int
2 B) float
C) char
D) double
UNIT: I

Which of the following is NOT a token in C?


A) Keywords
3 B) Identifiers
C) Comments
D) Operators

How many bytes does the int data type typically use on a 32-bit system?
A) 1 byte
4 B) 2 bytes
C) 8 bytes
D) 4 bytes

What is one of the main reasons C is widely used in system programming?


A) It is an interpreted language.
B) It provides low-level access to memory.
5 C) It is a purely object-oriented language.
D) It has no pointers.

Which of the following is a decision-making statement in C?


A) for
1 B) while
C) if
D) switch

Which of the following is a looping statement in C?


A) for
2 B) switch
C) if
D) return

What is the purpose of the break statement in a loop?


A) To pause the loop
UNIT: II

3 B) To exit the loop


C) To continue to the next iteration
D) To restart the loop
UNIT: I What does the switch statement do in C?
A) Repeats a block of code
B) Evaluates a condition
4 C) Executes one of many blocks of code
D) Declares a variable

In the condition if (x > 10), what will happen if x is 5?


A) The condition is true.
5 B) The condition is false.
C) It will cause an error.
D) The value of x will change.

How is a one-dimensional array declared in C?

a) int array[5];
1 b) int array{5};
c) int array(5);
d) int array<5>;

A two-dimensional array is best visualized as a:

a) Single row of data


2 b) List of characters
c) Matrix or table of data
d) Group of integers

What is the correct syntax to declare a string in C?


UNIT: III

a) char str[] = "Hello";


3 b) int str[] = "Hello";
c) float str[] = 'Hello';
d) double str[] = "Hello";

The function strcat() is used for:

a) Comparing two strings


4 b) Copying one string to another
c) Concatenating two strings
d) Reversing a string

What is an array?

a) A single variable that can hold multiple values


5 b) A function that returns a value
c) A collection of strings
d) A type of loop

What is a user-defined function?


A) A built-in function
B) A function created by the user
1 C) A function that cannot return a value
D) A function without parameters
What type of function does not return any value?
A) Void function
2 B) Integer function
C) Float function
D) String function

What is the primary difference between a structure and a union?


UNIT: IV

A) Structures can hold multiple data types; unions cannot.


3 B) Unions can hold multiple data types; structures cannot.
C) Structures use less memory than unions.
D) Unions cannot have members.

Which of the following is used to access a member of a structure?


A) &
4 B) *
C) .
D) ->

What is a structure in C?
A) A method for defining functions
B) A collection of different data types grouped together
5 C) A type of loop
D) An array of integers

What is the correct syntax to declare a pointer variable?


A) int ptr;
B) int *ptr;
C) pointer int ptr;
D) ptr int*;
1

How can you declare an array of pointers?


A) int *arr[10];
B) int arr*;
C) pointer int arr[10];
D) int arr(*);
2

What is a pointer in C?
A) A type of variable that stores a number
B) A variable that stores the address of another variable
UNIT: V

C) A function that returns a value


3 D) An array of integers
UN
Which header file is required for file operations in C?
A) <stdio.h>
B) <stdlib.h>
C) <string.h>
D) <file.h>
4

Which function is commonly used to write formatted output to a file?


A) fgets()
B) fwrite()
C) fprintf()
5 D) fscanf()

Faculty Name:
men

75

Semester: I

e/Subject: PROGRAMMING IN C

call the facts, terms, basic concepts, and answer ANSWERS


o set QPs.

rogramming language?

e character in C?

n C?

typically use on a 32-bit system?

dely used in system programming?

ry.
e. B

king statement in C?

ement in C?

ment in a loop?

B
C?

ppen if x is 5?

d in C?

ed as a:

string in C?

le values
a

B
e
any value?

n a structure and a union?


pes; unions cannot.
structures cannot. A
ons.

s a member of a structure?

rouped together
B

pointer variable?

rs?

ber
another variable

B
erations in C?

rite formatted output to a file?

C
P.K.R. Arts College for Women
(Autonomous)
Gobichettipalayam - 638 475
MCQ 2024-2025
WRITE-UP SHEET
Program: BCA & BSC(IT) & B.Sc(CS) Branch: COMPUTER SCIENCE
Course Code No.
24CSU01/24ITU01/24CAU01 Title of the Course/Subject: PROGRAMMING IN C

K2: Understand Level: (To assess whether the student understood the concepts, principles and Models taught in
the class and makes sense out of it.) Refer guidelines to set QPs

Which statement correctly declares an integer variable in C?


1 A) int num;
B) declare num: int;
C) integer num;
D) num : int;

Which function is used to read input from the user in C?


2 A) print()
B) scan()
C) scanf()
D) input()
UNIT: I

Which of the following correctly assigns the value 5 to the variable count?
3 A) count == 5;
B) 5 = count;
C) count := 5;
D) count = 5;

What is the correct way to define a symbolic constant for the value 100 in C?
4 A) #define 100 PI
B) const int PI = 100;
C) #define PI 100
D) int PI = 100;
Which operator is used to get the remainder of a division in C?
A) /
5 B) %
C) *
D) -
Answer: C) %
What will the following code print if a = 10 and b = 20? if (a
< b) {
printf("a is less than b");
} else {
printf("a is not less than b");
1 }
A) a is less than b
B) a is not less than b
C) No output
D) Syntax error

Given the following code, what will be the output if num = -5? if
(num > 0) {
printf("Positive");
2 } else if (num < 0) {
printf("Negative");
} else {
printf("Zero");
}
A) Positive
B) Negative
C) Zero
D) No output
I
What will be the output of the following code if count = 3? while
(count > 0) {
UNIT: II

3 printf("%d ", count);


count--;
}
A) 3 2 1
B) 2 1
C) 1
D) 3 2 1 0

How many times will the following loop execute? for


(int i = 0; i < 5; i++) {
printf("%d ", i);
4 }
A) 4 times
B) Infinite loop
C) 6 times
D) 5 times

What will be the output of the following code if choice = 5?switch (choice) {
case 1:
printf("One");
break;
5 case 2:
printf("Two");
break;
default:
printf("Invalid");
}
A) One
B) Two
C) Invalid
D) No output

1 What is the purpose of using an array in programming?

a) To execute loops
b) To store multiple values of the same data type under one variable name
c) To handle file I/O
d) To define constants

How would you access the element at row 2, column 3 in a 2D array called matrix?
2 a) matrix[3][2];
b) matrix(2,3);
c) matrix[2][3];
d) matrix{2,3};

3 What is the total number of elements in a 2D array declared as int matrix[4][6];?

a) 10
b) 12
UNIT: III

c) 24
d) 20
UNIT: III

4 Which of the following functions is used to read a string from input in C?

a) scanf()
b) gets()
c) printf()
d) strcpy()

5 What is the output of the following code?


char str1[10] = "Hello";
char str2[10] = "World";
strcat(str1, str2);
printf("%s", str1);
a) Hello
b) World
c) HelloWorld
d) Error
Which of the following best describes the need for user-defined functions?
A) They allow for code duplication.
B) They help break down complex problems into smaller, manageable parts.
C) They limit the reuse of code.
D) They are only useful for mathematical calculations.
1

What is a key element of user-defined functions that allows for data input?

A) Return type
B) Function body
C) Parameters
2 D) Function name

What happens when a recursive function does not have a termination condition?

A) It will terminate correctly.


UNIT: IV

B) It will create an infinite loop.


C) It will return an undefined value.
3 D) It will automatically generate a termination condition.

What is the primary advantage of using unions over structures?

A) Unions can hold different types of data simultaneously.


B) Unions use less memory than structures.
C) Unions allow for more complex data types.
4 D) There is no advantage; they are the same.
How do you initialize a structure variable with specific values?

A) struct var = {value1, value2};


B) struct var(value1, value2);
5 C) struct var = new {value1, value2};
D) var = {value1, value2};

What is the primary purpose of using pointers in C?

A) To increase memory usage


B) To enable dynamic memory allocation and efficient data manipulation
C) To simplify code syntax
1 D) To replace arrays entirely

Which operator is used to access the address of a variable?


A) *
B) &
C) ->
2 D) @

Which function is used to open a file in C?

A) open()
B) create()
UNIT: V

3 C) fopen()
D) fileopen()

What is the correct mode for opening a file for writing in C?

A) "r"
B) "w"
4 C) "a"
D) "rb"

How can you access the value of a variable using its pointer?

A) ptr*
B) *ptr
5 C) &ptr
D) ptr->

Faculty Name:
en

Semester: I

bject: PROGRAMMING IN C

ncepts, principles and Models taught in Answer


nes to set QPs

integer variable in C?
A

om the user in C?
C

s the value 5 to the variable count?


D

mbolic constant for the value 100 in C?


C

inder of a division in C?

10 and b = 20? if (a

he output if num = -5? if

B
g code if count = 3? while

execute? for

g code if choice = 5?switch (choice) {

n programming? b

data type under one variable name

ow 2, column 3 in a 2D array called matrix?


c

n a 2D array declared as int matrix[4][6];? c


b
d to read a string from input in C?

e? c

he need for user-defined functions?

lems into smaller, manageable parts.

al calculations.
B

unctions that allows for data input?

on does not have a termination condition?

ination condition. B

unions over structures?

ata simultaneously.
ures.
types. B
same.
le with specific values?

ointers in C?

n and efficient data manipulation


B

ddress of a variable?

C?

file for writing in C?

able using its pointer?

You might also like