
Q61
Q61 Pseudocode:
FUNCTION ConcatStrings(STRING str1, STRING str2) RETURN str1 PLUS str2 END FUNCTION
Concatenates two strings and returns the result
Finds the length of the two strings
Reverses the two strings
Compares the two strings
Q62
Q62 Pseudocode:
FUNCTION CopyString(STRING source, STRING destination) FOR EACH character IN source SET destination TO source END FOR
Copies one string to another
Compares two strings
Concatenates two strings
Reverses a string
Q63
Q63 Identify the error in this C code:
int main() {
char str[] = "Hello";
str[0] = 'M';
printf("%s", str);
return 0;
}
Cannot modify a string literal
No error
Syntax error
Wrong printf format
Q64
Q64 Spot the mistake:
int main() {
char *str = "Hello";
str[0] = 'M';
printf("%s", str);
return 0;
}
Cannot modify a string literal
Syntax error
No error
Wrong printf format
Q65
Q65 What is a structure in C?
A collection of variables under a single name
A method for looping
A data type for characters
A control flow statement
Q66
Q66 What is the key difference between a structure and a union in C?
A structure can store multiple data types, a union cannot
A union can store multiple data types, a structure cannot
In a structure, only one member can be accessed at a time
In a union, only one member can be accessed at a time
Q67
Q67 What does the following C code do?
struct Point {
int x, y;
};
struct Point p1 = {1, 2};
printf("%d %d", p1.x, p1.y);
Declares a structure and prints its members
Causes a syntax error
Initializes a structure but fails to print
None of the above
Q68
Q68 Spot the mistake:
struct Data { int val; }; int main() {
struct Data *ptr;
ptr->val = 100;
printf("%d", ptr->val);
return 0;
}
Uninitialized pointer used
Syntax error
No error
Wrong printf format
Q69
Q69 What is the purpose of the feof function in C?
To check if the end-of-file has been reached
To open a file
To read a file character by character
To write to a file
Q70
Q70 Complete the C code to read a binary file:
FILE *file = fopen("example.bin", "rb"); ___; fclose(file);
fread(buffer, sizeof(buffer), 1, file);
read(file, buffer, sizeof(buffer));
file >> buffer;
getline(file, buffer);
Q71
Q71 Identify the error in this C code for file writing:
FILE *file = fopen("example.txt", "w"); fprintf(file, "Hello World"); fclose(file);
Missing file mode in fopen
Incorrect usage of fprintf
No error
File not closed properly
Q72
Q72 Spot the mistake:
FILE *file = fopen("example.bin", "wb"); fwrite(&data, sizeof(data), 1, file); fclose(file);
Data should not be passed by reference in fwrite
fwrite arguments are in the wrong order
No error
File not opened in binary mode
Q73
Q73 What is the function of the #define directive in C?
To define a new function
To import a library
To define a macro or constant
To declare a variable
Q74
Q74 What is the result of using the #undef directive in C?
It deletes a file from the project
It removes a defined macro
It undefines a variable
It causes a compilation error
Q75
Q75 What is the purpose of argc in a C program?
To count the number of functions
To store environment variables
To count the number of command line arguments
To store error codes
Q76
Q76 How can you access the individual command line arguments in a C program?
Using a for loop with argc and argv
Through global variables
By indexing into a predefined array
By calling a special function
Q77
Q77 What is the main function of a compiler in programming?
To write code
To interpret code
To convert code into machine language
To debug code
Q78
Q78 How does a compiler differ from an interpreter?
A compiler executes code, while an interpreter does not
A compiler debugs code, while an interpreter does not
A compiler translates the entire program at once, while an interpreter translates it line by line
A compiler is used only in C programming, while an interpreter is not
Q79
Q79 What will be the output of the following C program?
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
Hello, World!
Syntax Error
0
Nothing
Q80
Q80 Which of the following is not a keyword in C?
int
char
include
float
Q81
Q81 Which of the following is a valid identifier in C?
2ndName
_name
#name
none of these
Q82
Q82 What is the difference between 'float' and 'double' data types in C?
Syntax only
Precision
Usage
No difference
Q83
Q83 Identify the error in this C code:
int main() {
int number = 100.5;
printf("%d", number);
return 0;
}
Assigning float to int
Syntax error
No error
Wrong printf format
Q84
Q84 What does %d signify in the printf or scanf function?
Double data type
Decimal integer
Dynamic allocation
Directory path
Q85
Q85 What will be the output of the following C code?
int main() {
printf("%d", 500);
return 0;
}
500
%d
Syntax Error
None of these
Q86
Q86 Pseudocode:
READ number PRINT "The number is ", number
What does this pseudocode do?
Reads and prints a number
Prints a fixed number
Generates a random number
None of these
Q87
Q87 Find the mistake in this code:
int main() {
float num;
printf("Enter a number: ");
scanf("%f", num);
printf("You entered: %f", num);
return 0;
}
Missing & in scanf
Incorrect format specifier in printf
No error
Syntax error
Q88
Q88 What does the '==' operator check?
Assignment
Equality
Greater than
Less than
Q89
Q89 What is the result of the logical expression (1 && 0)?
1
0
True
False
Q90
Q90 What does the '+' operator do in C?
Addition
Subtraction
Multiplication
Division


