Home Subjects Computer Knowledge

Computer Knowledge

Programming, networking, database and OS questions

94 Q 2 Topics Take Mock Test
Advertisement
Difficulty: All Easy Medium Hard 81–90 of 94
Topics in Computer Knowledge
All C Programming 200 Database/SQL 100
Q.81 Easy C Programming
Which of the following is NOT a valid C data type?
A float
B boolean
C double
D char
Correct Answer:  B. boolean
EXPLANATION

C does not have a built-in boolean data type. The other options (float, double, char) are all valid primitive data types in C. Boolean functionality is typically implemented using int (0 for false, non-zero for true).

Test
Q.82 Easy C Programming
What is the size of an integer variable in most modern C compilers?
A 2 bytes
B 4 bytes
C 8 bytes
D It depends on the compiler
Correct Answer:  B. 4 bytes
EXPLANATION

On most modern 32-bit and 64-bit systems, an int is typically 4 bytes (32 bits). However, the exact size can vary depending on the compiler and system architecture.

Test
Q.83 Easy C Programming
Which operator has the highest precedence in C?
A Addition (+)
B Multiplication (*)
C Parentheses ()
D Logical AND (&&)
Correct Answer:  C. Parentheses ()
EXPLANATION

Parentheses () have the highest precedence among all operators in C. They are always evaluated first in any expression.

Test
Q.84 Easy C Programming
What is the return type of the strlen() function?
A void
B char
C int
D float
Correct Answer:  C. int
EXPLANATION

The strlen() function returns the length of a string as an int value, representing the number of characters.

Test
Q.85 Easy C Programming
Which of the following is a valid variable name in C?
A 2var
B _variable
C var-name
D var name
Correct Answer:  B. _variable
EXPLANATION

Variable names in C must start with a letter or underscore, not a digit. _variable is valid. '2var' starts with digit, 'var-name' contains hyphen (invalid), 'var name' contains space (invalid).

Test
Q.86 Easy C Programming
Which header file is required to use the printf() function in C?
A #include
B #include
C #include
D #include
Correct Answer:  B. #include
EXPLANATION

The stdio.h header file contains declarations for standard input/output functions like printf() and scanf().

Test
Q.87 Easy C Programming
What does the strlen() function return?
A Number of characters in a string including null terminator
B Number of characters in a string excluding null terminator
C Size of memory allocated to string
D Address of the first character
Correct Answer:  B. Number of characters in a string excluding null terminator
EXPLANATION

strlen() returns the length of a string without counting the null terminator ('\0'). For example, strlen("hello") returns 5, not 6.

Test
Q.88 Easy C Programming
What is the output of the following C code?
int a = 10, b = 20;
int c = (a > b) ? a : b;
printf("%d", c);
A 10
B 20
C Compilation error
D 30
Correct Answer:  B. 20
EXPLANATION

The ternary operator (condition ? true_value : false_value) evaluates the condition (a > b). Since 10 is not greater than 20, it returns b which is 20.

Test
Q.89 Easy C Programming
What is the purpose of the 'void' keyword in C?
A To declare a function that returns nothing
B To declare a generic pointer
C Both A and B
D To declare empty variables
Correct Answer:  C. Both A and B
EXPLANATION

void is used in two contexts: (1) as a function return type when a function doesn't return a value, and (2) to declare a generic pointer (void *) that can point to any data type.

Test
Q.90 Easy C Programming
What will be the size of the following array in bytes?
char arr[10];
A 10 bytes
B 20 bytes
C 40 bytes
D 5 bytes
Correct Answer:  A. 10 bytes
EXPLANATION

Each char occupies 1 byte in memory. An array of 10 chars will occupy 10 × 1 = 10 bytes.

Test
IGET
IGET AI
Online · Exam prep assistant
Hi! 👋 I'm your iget AI assistant.

Ask me anything about exam prep, MCQ solutions, study tips, or strategies! 🎯
UPSC strategy SSC CGL syllabus Improve aptitude NEET Biology tips