Unit I MCQ
Unit I MCQ
Answer: B) Assembly
3. Which programming language was developed in the 1950s and is known for its use
in scientific and engineering applications?
o A) COBOL
o B) Lisp
o C) Fortran
o D) BASIC
Answer: C) Fortran
Answer: C) Lisp
Answer: B) 1972
8. Which programming paradigm focuses on the use of functions and avoids changing-
state and mutable data?
o A) Procedural Programming
o B) Object-Oriented Programming
o C) Functional Programming
o D) Logic Programming
9. Which programming language is widely known for its role in web development and
is often used on the client side?
o A) PHP
o B) Java
o C) JavaScript
o D) Ruby
Answer: C) JavaScript
Answer: B) Stack
1. What is an algorithm?
o A) A programming language syntax
o B) A step-by-step procedure for solving a problem
o C) A type of software application
o D) A debugging tool
Answer: A) IF-THEN-ELSE
10. In pseudocode, how would you typically indicate the start of a loop?
o A) BEGIN LOOP
o B) FOR each item IN list DO
o C) LOOP START
o D) START LOOP
Structure of C Program
1. Which of the following is the correct syntax for including a standard library in a C
program?
o A) #include <library.h>
o B) import library;
o C) include library.h;
o D) #include "library.h"
Answer: B) ;
Answer: A) const
Answer: C) scanf();
Answer: C) printf()
Answer: A) gets()
c
Copy code
int x = 5;
printf("%d", x++);
o A) 5
o B) 6
o C) 7
o D) Compilation error
Answer: A) 5
Answer: C) 1stTemp
6. What keyword is used to indicate that a variable cannot change its value after
initialization?
o A) final
o B) static
o C) const
o D) immutable
Answer: C) const
Answer: C) getchar()
Answer: B) for
2. Which of the following storage classes has the widest scope and lifetime throughout
the program?
o A) auto
o B) register
o C) static
o D) extern
Answer: D) extern
4. What keyword is used to declare a variable that retains its value even after the
function exits?
o A) auto
o B) static
o C) extern
o D) const
Answer: B) static
5. Which storage class limits the visibility of a variable to the block in which it is
defined?
o A) extern
o B) static
o C) auto
o D) register
Answer: C) auto
6. What is the default storage class for a variable declared inside a function without an
explicit storage class?
o A) extern
o B) static
o C) auto
o D) register
Answer: C) auto
Answer: B) To suggest that a variable should be stored in a CPU register for faster
access
10. Which of the following correctly describes the concept of variable scope?
o A) It defines the type of data the variable can hold.
o B) It determines the lifespan of the variable.
o C) It defines the region of the program where the variable can be accessed.
o D) It specifies how much memory the variable will use.
Answer: C) It defines the region of the program where the variable can be accessed.
2. What is the range of the int data type in C (typically on a 32-bit system)?
o A) -32,768 to 32,767
o B) -2,147,483,648 to 2,147,483,647
o C) 0 to 65,535
o D) -1.7 billion to 1.7 billion
Answer: B) char
Answer: C) float
Answer: B) Undefined
Answer: B) wchar_t
Answer: D) Both A and B (Note: The bool type is available in C99 and later; otherwise,
int is often used for boolean values.)
c
Copy code
printf("%d", sizeof(char));
o A) 1
o B) 2
o C) 4
o D) Depends on the system
Answer: A) 1
1. What is an lvalue in C?
o A) A value that can appear on the left side of an assignment
o B) A constant value that cannot change
o C) A temporary value that cannot be referenced
o D) A type of function
2. What is an rvalue in C?
o A) A value that can appear on the right side of an assignment
o B) A variable that can be modified
o C) A type of data structure
o D) A reference to a variable
Answer: C) int a;
Answer: C) x
Operators in C Language
1. Which operator is used for addition in C?
o A) -
o B) *
o C) /
o D) +
Answer: D) +
c
Copy code
int a = 10, b = 5;
printf("%d", a % b);
o A) 2
o B) 5
o C) 0
o D) 10
Answer: B) 0
Answer: B) *
Answer: B) 11
c
Copy code
int x = 5;
int y = x++;
printf("%d", y);
o A) 5
o B) 6
o C) 4
o D) 0
Answer: A) 5
Answer: B) &&
c
Copy code
int a = 10;
int b = 20;
printf("%d", (a > b) ? a : b);
o A) 10
o B) 20
o C) 0
o D) 1
Answer: B) 20
Answer: C) :=
c
Copy code
int a = 5;
a++;
printf("%d", a);
A) 5
B) 6
C) 4
D) 7
Answer: B) 6
A) --
B) -=
C) ++
D) -=1
Answer: A) --
c
Copy code
int x = 10;
int y = 20;
int z = (x++, y);
printf("%d", z);
A) 10
B) 20
C) 30
D) 0
Answer: B) 20
c
Copy code
struct Point {
int x;
int y;
};
struct Point p = {1, 2};
struct Point *ptr = &p;
printf("%d", ptr->y);
A) 1
B) 2
C) 0
D) Compilation error
Answer: B) 2
Which of the following is a correct way to assign the value of one variable to another?
A) a = b;
B) a := b;
C) a <-> b;
D) a -> b;
Answer: A) a = b;
c
Copy code
int a = 3;
int b = 4;
int c = a++ + ++b;
printf("%d", c);
A) 6
B) 7
C) 8
D) 11
Answer: C) 8
A) ;
B) :
C) ,
D) &
Answer: C) ,
c
Copy code
int a = 5;
a += 2; // Equivalent to a = a + 2;
printf("%d", a);
A) 5
B) 6
C) 7
D) 8
Answer: C) 7
A) The value of a
B) The value of b
C) The sum of a and b
D) The result of a++