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 71–80 of 94
Topics in Computer Knowledge
All C Programming 200 Database/SQL 100
Q.71 Easy C Programming
In C programming, which of the following is NOT a valid data type?
A int
B float
C string
D double
Correct Answer:  C. string
EXPLANATION

In C, 'string' is not a primitive data type. C uses 'char' arrays to represent strings. The valid primitive data types are int, float, double, char, void, and their variants.

Test
Q.72 Easy C Programming
What is the purpose of the break statement in a loop?
A Pause the loop temporarily
B Exit the loop immediately
C Restart the loop
D Skip the current iteration
Correct Answer:  B. Exit the loop immediately
EXPLANATION

The break statement exits or terminates the current loop immediately. Option D describes continue (which skips to next iteration), while break actually exits the loop.

Test
Q.73 Easy C Programming
In C, which operator has the highest precedence?
A Arithmetic operator
B Logical operator
C Parentheses ()
D Assignment operator
Correct Answer:  C. Parentheses ()
EXPLANATION

Parentheses have the highest precedence in C. Expressions within parentheses are evaluated first, followed by arithmetic operators, then logical operators, and finally assignment operators.

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

The stdio.h (Standard Input Output) header file contains declarations for printf(), scanf(), and other input/output functions. It is essential for console I/O operations.

Test
Q.75 Easy C Programming
What is the size of int data type in a 32-bit system?
A 2 bytes
B 4 bytes
C 8 bytes
D 1 byte
Correct Answer:  B. 4 bytes
EXPLANATION

In a 32-bit system, the int data type typically occupies 4 bytes (32 bits). This is the standard size for integer types on most 32-bit architectures.

Test
Q.76 Easy C Programming
What will be the value of x after: int x = 5; x += 3;
A 3
B 5
C 8
D 53
Correct Answer:  C. 8
EXPLANATION

The += operator is a compound assignment operator. x += 3 is equivalent to x = x + 3. Therefore, 5 + 3 = 8.

Test
Q.77 Easy C Programming
How many times will the loop execute?
for(int i = 0; i < 5; i++)
A 4 times
B 5 times
C 6 times
D Infinite times
Correct Answer:  B. 5 times
EXPLANATION

The loop initializes i to 0 and continues while i < 5. Values of i: 0, 1, 2, 3, 4. After i becomes 5, the condition is false, so the loop executes 5 times.

Test
Q.78 Easy C Programming
What is the output of sizeof(char) in C?
A 0 bytes
B 1 byte
C 2 bytes
D Varies by compiler
Correct Answer:  B. 1 byte
EXPLANATION

By the C standard, sizeof(char) is always 1 byte. A char is the smallest addressable unit in C and is defined to be 1 byte.

Test
Q.79 Easy C Programming
Which keyword is used to create a constant variable in C?
A final
B constant
C const
D static
Correct Answer:  C. const
EXPLANATION

The const keyword is used in C to declare a constant variable whose value cannot be modified after initialization. Variables declared as const are read-only.

Test
Q.80 Easy C Programming
What is the purpose of the & operator in C?
A Bitwise AND operation
B Address-of operator
C Both A and B
D Logical AND operation
Correct Answer:  C. Both A and B
EXPLANATION

The & operator has two uses in C: (1) When used before a variable, it returns the memory address of that variable (address-of operator), and (2) When used between two integers, it performs a bitwise AND operation.

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