Mathematics MCQ
Mathematics MCQ
Unit - I
1. The access method used for magnetic tape is ______.
A. Direct
B. Random
C. Sequential
D. None of the above
Ans: C
Explanation: -
Question Type: Moderately Easy
2. The difference between memory and storage is that the memory is ________storage is _____.
A. Temporary, permanent
B. Permanent, temporary
C. Slow, fast
D. None of the above
Ans: A
Explanation: -
Question Type: Moderate
3. Which of the Following holds the ROM, CPU, RAM and expansion cards?
A. Hard disk
B. Floppy disk
C. Mother board
D. None of the above
Ans: C
Explanation: -
Question Type: Moderate
4. The language that the computer can understand and execute is called
A. Machine language
B. Application software
C. System program
D. None of the above
Ans: A
Explanation: -
Question Type: Moderate
5. Which of the following devices can be used to directly input printed text?
A. OCR
B. OMR
C. MICR
D. None of the above
Ans: A
Explanation: -
Question Type: Moderately Easy
A. 1945 to 1954
B. 1964 to 1974
C. 1934 to 1944
D. 1937 to 1949
Ans: A
Explanation: -
Question Type: Moderately Easy
A. ALU
B. Control Unit
C. Storage unit
D. bus
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. Magnetic tape
B. PROM
C. Floppy disk
D. None of the above
Ans: B
Explanation: -
Question Type: Difficult
12. Indicate which of the following, best describes the term “software”
A. AnApplication software
B. Asystem software
C. A hardware component
D. None of the above
Ans: B
Explanation: -
Question Type: Moderately Difficult
14. C language is
A. An assembly language
B. A third generation high level language
C. A machine language
D. None of the above
Ans: B
Explanation: -
Question Type: Moderately Easy
A. program
B. software
C. data
D. none
Ans: B
Explanation: -
Question Type: Moderately Easy
A. FloppyDisk
B. Hard Disk
C. Magnetic Tapes
D. CDROM
Ans: C
Explanation: -
Question Type: Moderate
18. Which of the following device can store large amounts of data?
A. Floppy Disk
B. Hard Disk
C. CDROM
D. Zip Disk
Ans: B
Explanation: -
Question Type: Moderately Difficult
19. The Analytical Engine developed during First Generation of computers used ___ as a memory
unit.
A. RAM
B. Floppies
C. Cards
D. Counter Wheels
Ans: D
Explanation: -
Question Type: Moderately Difficult
20. Which of the memories below is often used in a typical computer operation?
A. RAM
B. ROM
C. FDD
D. HDD
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. IBM
B. Sony
C. Panasonic
D. Samsung
Ans: B
Explanation: -
Question Type: Moderate
22. Floppy Disk Drives were first introduced by which of the following computer manufacturers?
A. IBM
B. Sony
C. Panasonic
D. Compaq
Ans: A
Explanation: -
Question Type: Difficult
A. Hardware
B. Firmware
C. Software
D. None of these
Ans: B
Explanation: -
Question Type: Moderate
A. UniversalAutomatic Computer
B. UniversalArray Computer
C. Unvalued Automatic Computer
D. Unvalued Automatic Computer
Ans: A
Explanation: -
Question Type: Easy
A. Mechanical
B. Electromechanical
C. Optical
D. Fiber Optical
Ans: C
Explanation: -
Question Type: Moderate
A. Files
B. Directories
C. Floppies
D. Matter
Ans: A
Explanation: -
Question Type: Moderately Easy
A. FirstGeneration Computer
B. Second Generation Computer
C. Third Generation Computer
D. Fourth Generation Computer
Ans: B
Explanation: -
Question Type: Moderately Easy
A. First Generation
B. Second Generation
C. Third Generation
D. Fourth Generation
Ans: A
Explanation: -
Question Type: Easy
A. EDSAC
B. IBM-1401
C. CDC-1604
D. ICL-2900
Ans: A
Explanation: -
Question Type: Moderately Easy
A. Transistors
B. Vacuum Tubes and Valves
C. Integrated Circuits
D. None of above
Ans: B
Explanation: -
Question Type: Moderate
A. 1949 to 1955
B. 1956 to 1965
C. 1965 to 1970
D. 1970 to 1990
Ans: B
Explanation: -
Question Type: Moderate
39. FORTRAN is
A. File
Translation
B. Format Translation
C. Formula Translation
D. Floppy Translation
Ans: C
Explanation: -
Question Type: Easy
A. FirstGeneration
B. Second Generation
C. Third Generation
D. Fourth Generation
Ans: D
Explanation: -
Question Type: Moderately Easy
43. Modern Computer are very reliable but they are not
A. Fast
B. Powerful
C. Infallible
D. Cheap
Ans: D
Explanation: -
Question Type: Moderately Difficult
A. DennisM. Ritchie
B. NiklausWrith
C. Seymour Papert
D. Donald Kunth
Ans: A
Explanation: -
Question Type: Easy
A. Parallel only
B. Sequentially only
C. Both sequentially and parallel
D. All of above
Ans: C
Explanation: -
Question Type: Moderate
A. Primarymemory
B. Controlsection
C. External memory
D. Cache memory
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. More expensive
B. More portable
C. Less rigid
D. Slowly accessed
Ans: A
Explanation: -
Question Type: Moderately Difficult
50. A storage area used to store data to a compensate for the difference in speed at which the different
units can handle data is
A. Memory
B. Buffer
C. Accumulator
D. Address
Ans: B
Explanation: -
Question Type: Moderately Difficult
51. acomputer which CPU speed around 100 million instruction per second and with the word length
of around 64 bits is known as
A. Supercomputer
B. Minicomputer
C. Micro computer
D. Macro computer
Ans: A
Explanation: -
Question Type: Difficult
A. Bus
B. Control unit
C. Semiconductors
D. A and B only
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. One bit
B. Four bits
C. Eight bits
D. Sixteen bits
Ans: C
Explanation: -
Question Type: Easy
A. Optical scanner
B. Mouse and digitizer
C. Light pen
D. All of the above
Ans: D
Explanation: -
Question Type: Moderately Easy
56. The silicon chips used for data processing are called
A. RAM chips
B. ROM chips
C. Micro processors
D. PROM chips
Ans: A
Explanation: -
Question Type: Moderately Difficult
59. Algorithm is
A. Flowchart
B. Dataflow Diagram
C. Algorithm design
D. Pseudo code
Ans: A
Explanation: -
Question Type: Moderately Difficult
61. The ALU of a computer normally contains a number of high speed storage element called
A. Semiconductor memory
B. Registers
C. Hard disks
D. Magnetic disk
Ans: C
Explanation: -
Question Type: Moderate
62. The
magnetic storage chip used to provide non-volatile direct access storage of data and that have
no moving parts are known as
63. What difference does 5th generation computer have from other generation computer?
A. Technological advancement
B. Scientific code
C. Object Oriented Programming
D. all of the above
Ans: D
Explanation: -
Question Type: Moderate
64. Which of the following computer generation uses concept of artificial intelligent?
A. firstgeneration
B. Second generation
C. third generation
D. forth generation
Ans: D
Explanation: -
Question Type: Moderately Difficult
65. When a key is passed on keyboard, which standard is used for converting the keystroke into the
corresponding bits.
A. ANSI
B. ASCII
C. EBCDIC
D. ISO
Ans: B
Explanation: -
Question Type: Difficult
66. Which device is used as the standard pointing device in a Graphical User Environment?
A. Keyboard
B. Mouse
C. Joystick
D. trackball
Ans: B
Explanation: -
Question Type: Moderate
A. CPU
B. keyboard
C. Pen Drive
D. Track Balll
Ans: C
Explanation: -
Question Type: Moderately Difficult
68. The section of the CPU that is responsible for performing mathematical operation.
A. Memory
B. Register unit
C. Control unit
D. ALU
Ans: D
Explanation: -
Question Type: Moderately Easy
69. Any storage device added to computer beyond the immediately usable main storage is known as
A. Floppydisk
B. Hard Disk
C. Backing store
D. Punched Card
Ans: A
Explanation: -
Question Type: Moderate
A. Computer Program
B. Algorithm
C. Flowchart
D. Utility Program
Ans: A
Explanation: -
Question Type: Moderate
A. Touch Pad
B. Mouse
C. Printer
D. Joystick
Ans: C
Explanation: -
Question Type: Easy
A. Task Manager
B. Task Bar
C. Program Manager
D. Device Driver
Ans: D
Explanation: -
Question Type: Moderate
A. Compiler
B. Power Point
C. Debugger
D. None of the above
Ans: B
Explanation: -
Question Type: Moderately Difficult
A. Linux
B. Word
C. Excel
D. Tally
Ans: A
Explanation: -
Question Type: Moderately Difficult
75. The Programs which are as permanent as hardware and stored in ROM is known as
A. Hardware
B. Software
C. Firmware
D. ROMware
Ans: C
Explanation: -
Question Type: Moderate
A. InputDevice
B. StepperMotor
C. Memory
D. None of the above
Ans: B
Explanation: -
Question Type: Moderate
A. Printer
B. VDU
C. Scanner
D. All
Ans: C
Explanation: -
Question Type: Difficult
A. Gaming
B. Weatherforecast
C. Word Processing
D. all
Ans: A
Explanation: -
Question Type: Moderately Easy
A. ALU+CU
B. ROM+ALU
C. RAM+ROM
D. None
Ans: A
Explanation: -
Question Type: Moderately Easy
A. ROM
B. EPROME
C. RAM
D. None
Ans: C
Explanation: -
Question Type: Moderate
A. RAM
B. EERAM
C. ROM
D. PROM
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. GB
B. MB
C. KB
D. all
Ans: D
Explanation: -
Question Type: Moderate
A. one hundred
B. one thousand twenty four
C. one million
D. one billion
Ans: B
Explanation: -
Question Type: Moderately Difficult
A. used to store files and programs temporarily for fast and easy access by the CPU
B. a type of permanent memory used by the computer to establish basic input and output
C. a device that reads data stored on hard disks
D. adevice that usually contains the circuitry for the central processing unit, keyboard, and monitor
and often having slots for accepting additional circuitry
Ans: D
Explanation: -
Question Type: Moderate
A. tape
B. semiconductor memory
C. disk
D. bubble memory
Ans: B
Explanation: -
Question Type: Moderate
A. IC-Chip
B. Transistors
C. Vaccum tubes
D. Microprocessor chip
Ans: B
Explanation: -
Question Type: Moderate
A. CRT
B. line printer
C. computer console
D. card reader
Ans: B
Explanation: -
Question Type: Moderately Difficult
91. Which
one of the following can produce the final product of machine processing in a form usable
by humans
A. storage
B. control
C. input device
D. output device
Ans: D
Explanation: -
Question Type: Difficult
A. input media
B. output media
C. secondary storage media
D. all of the above
Ans: D
Explanation: -
Question Type: Moderately Easy
95. A microcomputer consists of atleast an input unit, an output unit, microprocessor unit and a
A. stabilizer
B. memory unit
C. printer
D. network
Ans: B
Explanation: -
Question Type: Difficult
A. 1946
B. 1938
C. 1941
D. 1950
Ans: A
Explanation: -
Question Type: Difficult
A. machine language
B. assembly language
C. structure programming
D. object oriented programming
Ans: C
Explanation: -
Question Type: Easy
2. What is a program?
A. A set of instruction
B. A set of algorithm
C. A set of pseudo code
D. All of above
Ans: A
Explanation: -
Question Type: Easy
3. Which year was C developed ?
A. 1975
B. 1980
C. 1972
D. 1971
Ans: C
Explanation: -
Question Type: Moderately Easy
A. DOS only
B. Linux only
C. window only
D. All of the above
Ans: D
Explanation: -
Question Type: Moderate
A. int a=10;
B. float a=10.45;
C. char name=C
D. int value=0;
Ans: C
Explanation: -
Question Type: Moderate
A. int length
B. char int
C. int long
D. ll
Ans: A
Explanation: -
Question Type: Moderate
#include<stdio.h>
int main()
{
int a=100, b=200, c;
c = (a == 100 || b > 200);
printf("c=%d\n", c);
return 0;
}
A. c=400
B. c=100
C. c=300
D. c=200
Ans: C
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
int main()
{
int x=55;
printf("%d, %d, %d\n", x<=55, x=40, x>=10);
return 0;
}
A. 1, 40, 1
B. 1, 50, 1
C. 1, 55, 1
D. 1, 45, 1
Ans: A
Explanation: -
Question Type: Difficult
A. Floatvalues
B. Character values
C. Integer values
D. Both b&c
Ans: D
Explanation: -
Question Type: Moderate
A. Constants
B. Variables
C. Data Type
D. string
Ans: B
Explanation: -
Question Type: Moderately Easy
13. The correct way to round off a floating number x to an integer value is
A. y = int (x + 0.5)
B. y = (int) (x + 0.5)
C. y = (int) x + 0.5
D. y = (int) ((int)x + 0.5)
Ans: B
Explanation: -
Question Type: Moderately Easy
A. intn = 32;
B. char ch = 65;
C. float f = (float) 3.2;
D. None of the above
Ans: D
Explanation: -
Question Type: Moderate
A. extern
B. local
C. auto
D. global
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. 2
B. 20
C. 4
D. 28
Ans: A
Explanation: -
Question Type: Difficult
A. 3
B. 5
C. 8
D. garbage valuie
Ans: D
Explanation: -
Question Type: Moderate
A. 20 20
B. 20 40
C. 40 40
D. error
Ans: B
Explanation: -
Question Type: Moderate
A. 3 322
B. 3 3 0 2.000000
C. 3 2 0.000000 3.000000
D. 0 2 0.000000 2.0000000
Ans: D
Explanation: -
Question Type: Difficult
A. -3 3
B. -6 0
C. 0 -6
D. none of the above
Ans: C
Explanation: -
Question Type: Moderate
A. 8
B. 0
C. compilor error
D. error
Ans: C
Explanation: -
Question Type: Moderate
B. 4 (size of float)
C. 8 (size of double)
D. Garbage value
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. 4 27
B. 4 45
C. 2 2 5
D. compile Time Error:expression not allowed inside size of
Ans: B
Explanation: -
Question Type: Moderate
A. 16
B. Error: cannot find size of modifiers
C. 8
D. Error: undefined operator +++
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. 9, 10
B. 10,9
C. 0,0
D. 0,9
Ans: B
Explanation: -
Question Type: Moderate
28. The correct way to round off a floating number x to an integer value is
A. y = int (x + 0.5)
B. y = (int) (x + 0.5)
C. y = (int) x + 0.5
A. intn = 32;
B. char ch = 65;
C. float f = (float) 3.2;
D. None of the above
Ans: D
Explanation: -
Question Type: Moderately Easy
A. +=
B. *=
C. /=
D. all the above
Ans: D
Explanation: -
Question Type: Moderate
A. 2
B. 3
C. 0
D. 2.5
Ans: D
Explanation: -
Question Type: Easy
A. Number Specifier
B. contriolstring
C. Access Specifier
D. None of the above
Ans: B
Explanation: -
Question Type: Moderately Easy
A. Safewords
B. Static
words
C. Reserved words
D. Reused words
Ans: C
Explanation: -
Question Type: Easy
A. switch()
B. main()
C. struct ()
D. for ()
Ans: B
Explanation: -
Question Type: Moderately Easy
A. 10
B. 15
C. 11
D. 40
Ans: B
Explanation: -
Question Type: Moderate
A. 7
B. 15
C. 14
D. 16
Ans: C
Explanation: -
Question Type: Difficult
A. -1
B. 0
C. 1
D. 2
Ans: C
Explanation: -
Question Type: Difficult
A. -1
B. 0
C. 1
D. 2
Ans: B
Explanation: -
Question Type: Moderate
A. 10
B. 9
C. 11
D. 8
Ans: A
Explanation: -
Question Type: Moderately Easy
Value=17 value=16
A. value=22
value=17
B. value=19
value=16
C. value=22
value=18
D. value=20
value=16
Ans: C
Explanation: -
Question Type: Moderate
43. What is the final value of x when the code int x; for(x=0;x<=10;x++){} is run ?
A. 10
B. 9
C. 0
D. 11
Ans: D
Explanation: -
Question Type: Moderately Difficult
A. repeat until
B. do while
C. while
D. for
Ans: A
Explanation: -
Question Type: Moderately Easy
C. The do-while statement’s condition is used to decide whether to enter the loop or not
whereas the while
statement’s condition is used to decide whether to exit the loop or not
D. The while statement’s condition is used to decide whether to enter the loop or not whereas
the do-while
statement’s condition is used decide whether to exit the loop or not
Ans: D
Explanation: -
Question Type: Moderate
A. exit
B. beark
C. goto
D. switch
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. if else
B. switchcase
C. bothA &B
D. do-while
Ans: B
Explanation: -
Question Type: Moderate
51. Observe the following block of code and determine what happens when x=2?
Switch(x)
{
Case 1 : printf(“x is 1”)
break;
Case 2:
Case 3 : printf(“x is 3”);
break;
default:
printf(”X is not within the range”)
}
A. Program jumps to the end of switch statement since there is nothing to do for x=2
B. The code inside default will run since there is no task for x=2
C. Will display x is 3,and then come outside the switch statement
D. None of above
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. 1
B. 2
C. 3
D. none of above
Ans: D
Explanation: -
Question Type: Easy
A. 1
B. 2
C. 3
D. none of above
Ans: A
Explanation: -
Question Type: Easy
55. Thefor loop execution has statements inside the loop executed before checking the
condition for the first time
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
56. The” while” loop can be replaced by “for” loop in all the cases
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Easy
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
61. There can be a condition in the brackets associated with the switch statement
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderate
62. “break” statement is compulsory after every case in the “switch-case” statement
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
63. “default” statement is compulsory after every case in the “switch-case” statement
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
A. Outside the loop ,to the next statement after the loop
B. beginning of the loop i.e. to the first statement in the loop
C. outside the function, to the next function in the program
D. Beginning of the function to the next function in the program
Ans: B
Explanation: -
Question Type: Moderate
A. 1
11
11 1
1111
111111
B. 11111
C. 11111
1111
111
11
1
D. 1
1
1
1
1
Ans: A
Explanation: -
Question Type: Difficult
A. Yes
B. No
C. error
D. compilor error
Ans: A
Explanation: -
Question Type: Moderately Difficult
A. 34
B. 2
C. 4
D. 66
Ans: B
Explanation: -
Question Type: Moderately Easy
A. Do loop
B. for loop
C. switch statement
D. all of above
Ans: D
Explanation: -
Question Type: Moderate
69. In
which statements, does a CONTINUE statement cause the control to go directly to the test
condition and then continue the looping process?
A. FORand WHILE
B. WHILE and IF-ELSE
C. DO-WHILE AND IF-ELSE
D. WHILE AND DO- WHILE
Ans: D
Explanation: -
Question Type: Moderately Difficult
A. equal
B. Greater than
C. Less than
D. none of above
Ans: A
Explanation: -
Question Type: Moderate
void main()
{
int i=1,j=1;
while (++i < 10)
printf("%d ",i);
printf("\n");
while (j++ < 10)
printf("%d ",j);
}
A. 12 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
B. 1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
C. 2 3 4 5 6 7 8 9
2 3 4 5 6 7 8 9 10
D. 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7 8 9 10
Ans: C
Explanation: -
Question Type: Moderately Difficult
A. 8 8
B. 8 12
C. 6 6
D. 2 3
Ans: B
Explanation: -
Question Type: Moderate
A. 32
B. 35
C. 38
D. 31
Ans: A
Explanation: -
Question Type: Moderate
A. typedef
B. const
C. near
D. complex
Ans: C
Explanation: -
Question Type: Moderately Easy
A. Info world
B. ABC Info world
C. strxfrm
D. strcut
Ans: B
Explanation: -
Question Type: Difficult
A. a=300
B. a=100
C. a=200
D. none of these
Ans: C
Explanation: -
Question Type: Difficult
A. do-while
B. if-else
C. goto
D. for
Ans: C
Explanation: -
Question Type: Moderately Easy
A. ++
B. %
C. +
D. ||
Ans: B
Explanation: -
Question Type: Moderately Easy
80. Which pair of functions below are used for single character I/O ?
A. getchar()
B. getch()
C. getche()
D. both A and B
Ans: A
Explanation: -
Question Type: Moderate
A. 50 50 50
B. Compile Time Error
C. 10 10 10
D. Three Gaebage Value
Ans: C
Explanation: -
Question Type: Moderately Difficult
84. Which of the following is the correct order of evaluation for the below expression?
z=x+y*z/4%2-1
A. * / % + - =
B. * / % - =+
C. * / + - =%
D. * % + - =/
Ans: A
Explanation: -
Question Type: Moderately Difficult
85. Which of the following is the correct usage of conditional operators used in C?
A. a>b ? c=30 : c=40;
B. a>b ? c=30;
C. max = a>b ? a>c?a:c:b>c?b:c
D. return (a>b)?(a:b)
Ans: C
Explanation: -
Question Type: Moderately Difficult
86. Associativity has no role to play unless the precedence of operator is same.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
87. The expression of the right hand side of || operators doesnot get evaluated if the left hand side
determines the outcome.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
88. In the expression a=b=5 the order of Assignment is NOT decided by Associativity of operators
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
91. Assunming, integer is 2 byte, What will be the output of the program?
#include<stdio.h>
int main()
{
printf("%x\n", -2<<2);
return 0;
}
A. ffff
B. 5678
C. fff8
D. 6fff
Ans: C
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
int main()
{
int i=-3, j=2, k=0, m;
m = ++i && ++j || ++k;
printf("%d, %d, %d, %d\n", i, j, k, m);
return 0;
}
A. 3,2,1,1
B. 3,2,1,1
C. -2,3, 0, 1
D. 3,2,0,1
Ans: C
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
int main()
{
int x=4, y, z;
y = --x;
z = x--;
printf("%d, %d, %d\n", x, y, z);
return 0;
}
A. 2, 3, 3
B. 3, 3, 3
C. 2, 3, 1
D. 2, 2, 2
Ans: A
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
int main()
{
int i=3;
i = i++;
printf("%d\n", i);
return 0;
}
A. 3
B. 4
C. 2
D. 1
Ans: B
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
void main(){
printf("%s",arr);
#include<stdio.h>
void main(){
char arr[20]="MysticRiver";
printf("%d",sizeof(arr));
A. 20
B. 11
C. 2
D. 22
Ans: A
Explanation: -
Question Type: Moderate
#include<stdio.h>
void main(){
int const SIZE=5;
int expr;
double value[SIZE]={2.0,4.0,6.0,8.0,10.0};
expr=1|2|3|4;
printf("%f",value[expr]);
A. 2.000000
B. 4.000000
C. 6.000000
D. Compilation error
Ans: D
Explanation: -
Question Type: Moderate
#include<stdio.h>
#define var 3
void main(){
char *cricket[var+~0]={"clarke","kallis"};
char *ptr=cricket[1+~0];
printf("%c",*++ptr);
A. k
B. a
C. 1
D. i
Ans: C
Explanation: -
Question Type: Easy
5. What will happen if in a C program you assign a value to an array element whose subscript exceeds
the size of array?
A. The element will be set to 0.
B. The compiler would report an error.
C. The program may crash if some important data gets overwritten.
D. The array size would appropriately grow.
Ans: C
Explanation: -
Question Type: Moderate
B. First
element of the array
C. Baseaddress of the array
D. Address of the last element of array
Ans: C
Explanation: -
Question Type: Moderate
#include<stdio.h>
#define var 3
void main(){
char data[2][3][2]={0,1,2,3,4,5,6,7,8,9,10,11};
printf("%o",data[0][2][1]);
A. 5
B. 6
C. 7
D. 8
Ans: A
Explanation: -
Question Type: Moderate
#include<stdio.h>
#define var 3
void main(){
short num[3][2]={3,6,9,12,15,18};
printf("%d %d",*(num+1)[1],**(num+2));
A. 12 15
B. 12 12
C. 15 15
D. 15 12
Ans: C
Explanation: -
Question Type: Moderate
#include<stdio.h>
void main(){
int arr[][3]={{1,2},{3,4,5},{5}};
printf("%d %d %d",sizeof(arr),arr[0][2],arr[1][2]);
A. 18 55
B. 18 66
C. 18 0 5
D. 18 0 0
Ans: C
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
void main(){
int xxx[10]={5};
printf("%d %d",xxx[1],xxx[9]);
A. 0 0
B. 0 5
C. 1 5
D. 0 5
Ans: A
Explanation: -
Question Type: Moderately Difficult
11. The index or subscript value for an array of size n ranges from
A. 1 to n-1
B. 0 to n-1
C. n to n-1
D. 1 to n
Ans: B
Explanation: -
Question Type: Difficult
A. system dependent.
B. in row major dependent.
C. compiler dependent.
D. in column major dependent.
Ans: C
Explanation: -
Question Type: Moderately Easy
A. int a[50];
B. float values[10][20];
C. double a[50];
D. int score[10,15];
Ans: D
Explanation: -
Question Type: Difficult
A. value.
B. reference.
C. both value & reference.
D. none of the above
Ans: B
Explanation: -
Question Type: Moderate
A. 8
B. 9
C. 7
D. 10
Ans: A
Explanation: -
Question Type: Moderately Easy
A. a[1] to a[10].
B. a[1] to a[9].
C. a[0] to a[9].
D. a[0] to a[10].
Ans: C
Explanation: -
Question Type: Moderately Easy
20. Does this mentioning array name gives the base address in all the contexts?
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
22. Are the expressions arr and &arr same for an array of 10 integers?
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
A. 15,3,2
B. 3, 2, 15
C. 2, 5, 12
D. 23, 5, 2
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
int main()
{
static int a[2][2] = {1, 2, 3, 4};
int i, j;
static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
for(i=0; i<2; i++)
{
for(j=0; j<2; j++)
{
printf("%d, %d, %d, %d\n", *(*(p+i)+j), *(*(j+p)+i),
*(*(i+p)+j), *(*(p+j)+i));
}
}
return 0;
}
A. 1, 1, 1, 1
2, 3, 2, 3
3, 2, 3, 2
4, 4, 4, 4
B. 1, 1, 1, 1
2, 2, 2, 2
2, 2, 2, 2
3, 3, 3, 3
C. 1, 2, 1, 2
2, 3, 2, 3
3, 4, 3, 4
4, 2, 4, 2
D. 1, 2, 3, 4
2, 3, 4, 1
3, 4, 1, 2
4, 1, 2, 3
Ans: B
Explanation: -
Question Type: Moderate
25. What will be the output of the program if the array begins at 65472 and each integer occupies 2
bytes?
#include<stdio.h>
int main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u\n", a+1, &a+1);
return 0;
}
A. 65474, 65476
B. 65480, 65496
C. 65480, 65488
D. 65474, 65488
Ans: B
Explanation: -
Question Type: Moderate
26. what will be the output of the program in Turb C (under DOS)?
#include<stdio.h>
int main()
{
int arr[5], i=0;
while(i<5)
arr[i]=++i;
return 0;
}
A. 1, 2, 3, 4, 5,
B. 0, 1, 2, 3, 4,
C. Garbage value, 1, 2, 3, 4,
D. 2, 3, 4, 5, 6,
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
int main()
{
int arr[1]={10};
printf("%d\n", 0[arr]);
return 0;
}
A. 1
B. 10
C. 0
D. 6
Ans: B
Explanation: -
Question Type: Moderate
28. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
int main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u\n", arr, &arr);
return 0;
}
A. 65486, 65488
B. 65486, 65486
C. 65486, 65490
D. 65486, 65487
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
int main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d\n", sizeof(arr)/sizeof(arr[0]));
return 0;
}
A. 5
B. 4
C. 6
D. 7
Ans: B
Explanation: -
Question Type: Moderately Easy
30. What will be the output of the program if the array begins 1200 in memory?
#include<stdio.h>
int main()
{
int arr[]={2, 3, 4, 1, 6};
printf("%u, %u, %u\n", arr, &arr[0], &arr);
return 0;
}
#include<stdio.h>
int main()
{
int a[3][4];
fun(a);
return 0;
}
Ans: A
Explanation: -
Question Type: Moderate
32. Which of the following statements mentioning the name of the array begins DOES NOT yield the
base address?
1: When array name is used with the sizeof operator.
2: When array name is operand of the & operator.
3: When array name is passed to scanf() function.
4: When array name is passed to printf() function.
A. 1
B. 1,2
C. 2
D. 2,4
Ans: B
Explanation: -
Question Type: Moderately Easy
33. Which of the following statements are correct about the program below?
#include<stdio.h>
int main()
{
int size, i;
scanf("%d", &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf("%d", arr[i]);
printf("%d", arr[i]);
}
return 0;
}
.
A. The code is erroneous since the subscript for array used in for loop is in the range 1 to size.
B. The code is erroneous since the values of array are getting scanned through the loop.
C. The code is erroneous since the statement declaring array is invalid.
D. The code is correct and runs successfully
Ans: C
Explanation: -
Question Type: Difficult
34. Which of the following statements are correct about 6 used in the program?
int num[6];
num[6]=21;
A. In the first statement 6 specifies a particular element, whereas in the second statement it
specifies a type.
B. In the first statement 6 specifies a array size, whereas in the second statement it specifies a
particular element of array.
C. In the first statement 6 specifies a particular element, whereas in the second statement it
specifies a array size.
D. In both the statement 6 specifies array size.
Ans: B
Explanation: -
Question Type: Difficult
A. 1
B. 1, 4
C. 2, 3
D. 2, 4
Ans: B
Explanation: -
Question Type: Difficult
36. What
is the correct syntax to send a 3-dimensional array as a parameter?
(Assuming declaration int a[5][4][3];)
A. func(a);
B. func(&a);
C. func(*a);
D. func(**a);
Ans: A
Explanation: -
Question Type: Difficult
A. Matrix-Multiplication
B. Minimum Spanning Tree
C. Finding connectivity between nodes
D. All of the mentioned
Ans: D
Explanation: -
Question Type: Moderately Easy
#include <stdio.h>
int main()
{
int ary[2][3];
foo(ary);
}
void foo(int *ary[])
{
int i = 10, j = 2, k;
ary[0] = &i;
ary[1] = &j;
*ary[0] = 2;
for (k = 0;k < 2; k++)
printf("%d\n", *ary[k]);
}
A. 2 2
B. Compile time error
C. Undefined behaviour
D. 10 2
Ans: A
Explanation: -
Question Type: Moderately Difficult
#include <stdio.h>
int main()
{
int ary[2][3];
foo(ary);
}
void foo(int (*ary)[3])
{
int i = 10, j = 2, k;
ary[0] = &i;
ary[1] = &j;
for (k = 0;k < 2; k++)
printf("%d\n", *ary[k]);
}
#include <stdio.h>
int main()
{
foo(ary);
}
void foo(int **ary)
{
int i = 10, k = 10, j = 2;
int *ary[2];
ary[0] = &i;
ary[1] = &j;
printf("%d\n", ary[0][1]);
}
A. 10
B. 2
C. Compile time error
D. Undefined behaviour
Ans: D
Explanation: -
Question Type: Moderately Difficult
#include <stdio.h>
int main()
{
int ary[2][3][4], j = 20;
ary[0][0] = &j;
printf("%d\n", *ary[0][0]);
}
#include <stdio.h>
int main()
{
int ary[2][3];
ary[][] = {{1, 2, 3}, {4, 5, 6}};
printf("%d\n", ary[1][0]);
}
#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
A. 1 23450
B. 1 2 3 4 5 junk
C. 1 2 3 4 5 5
D. Run time error
Ans: A
Explanation: -
Question Type: Moderately Difficult
#include <stdio.h>
void main()
{
int a[2][3] = {1, 2, 3, , 4, 5};
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
A. 1 2 3 junk 4 5
B. Compile time error
C. 1 2 3 0 4 5
D. 1 2 3 3 4 5
Ans: B
Explanation: -
Question Type: Moderately Difficult
#include <stdio.h>
void f(int a[][3])
{
a[0][1] = 3;
int i = 0, j = 0;
for (i = 0; i < 2; i++)
for (j = 0; j < 3; j++)
printf("%d", a[i][j]);
}
void main()
{
int a[2][3] = {0};
f(a);
}
A. 030000
B. Junk 3 junk junk junk junk
C. Compile time error
D. All junk values
Ans: A
Explanation: -
Question Type: Moderately Easy
#include <stdio.h>
int main()
{
int x = 1;
if (x > 0)
printf("inside if\n");
else if (x > 0)
printf("inside elseif\n");
}
A. inside if
B. inside elseif
C. inside if
inside elseif
D. Compile time error
Ans: A
Explanation: -
Question Type: Moderately Easy
#include <stdio.h>
int main()
{
int x = 0;
if (x++)
printf("true\n");
else if (x == 1)
printf("false\n");
}
A. true
B. false
C. Compile time error
D. Undefined behaviour
Ans: B
Explanation: -
Question Type: Easy
#include <stdio.h>
int main()
{
int x = 0;
if (x == 1)
if (x == 0)
printf("inside if\n");
else
printf("inside else if\n");
else
printf("inside else\n");
}
A. insideif
B. insideelse if
C. inside else
D. Compile time error
Ans: C
Explanation: -
Question Type: Moderately Difficult
#include <stdio.h>
int main()
{
int a = 1;
if (a--)
printf("True");
if (a++)
printf("False");
}
A. True
B. False
C. True False
D. No Output
Ans: A
Explanation: -
Question Type: Moderately Easy
#include<stdio.h>
void main(){
printf("%s",arr);
C. Queen
D. null
Ans: D
Explanation: -
Question Type: Easy
#include<stdio.h>
void main(){
char arr[20]="MysticRiver";
printf("%d",sizeof(arr));
A. 20
B. 11
C. 12
D. 22
Ans: A
Explanation: -
Question Type: Moderately Easy
#include<stdio.h>
void main(){
int const SIZE=5;
int expr;
double value[SIZE]={2.0,4.0,6.0,8.0,10.0};
expr=1|2|3|4;
printf("%f",value[expr]);
A. 2.000000
B. 4.000000
C. 6.000000
D. Compilation error
Ans: B
Explanation: -
Question Type: Moderately Easy
#include<stdio.h>
enum power{
Dalai,
Vladimir=3,
Barack,
Hillary
};
void main(){
float leader[Dalai+Hillary]={1.f,2.f,3.f,4.f,5.f};
printf("%0.f",leader[p>>1+1]);
}
A. 1
B. 2
C. 3
D. 5
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
#define var 3
void main(){
char *cricket[var+~0]={"clarke","kallis"};
char *ptr=cricket[1+~0];
printf("%c",*++ptr);
A. k
B. a
C. l
D. i
Ans: C
Explanation: -
Question Type: Difficult
#include<stdio.h>
#define var 3
void main(){
char data[2][3][2]={0,1,2,3,4,5,6,7,8,9,10,11};
printf("%o",data[0][2][1]);
A. 5
B. 6
C. 7
D. 8
Ans: A
Explanation: -
Question Type: Moderately Difficult
#include<stdio.h>
#define var 3
void main(){
short num[3][2]={3,6,9,12,15,18};
printf("%d %d",*(num+1)[1],**(num+2));
A. 12 15
B. 12 12
C. 15 15
D. 15 12
Ans: A
Explanation: -
Question Type: Moderately Difficult
8. .#include<stdio.h>
#define var 3
void main(){
char *ptr="cquestionbank";
printf("%d",-3[ptr]);
A. 100
B. -100
C. 101
D. -101
Ans: D
Explanation: -
Question Type: Moderate
#include<stdio.h>
void main(){
long myarr[2][4]={0l,1l,2l,3l,4l,5l,6l,7l};
printf("%ld\t",myarr[1][2]);
printf("%ld%ld\t",*(myarr[1]+3),3[myarr[1]]);
printf("%ld%ld%ld\t" ,*(*(myarr+1)+2),*(1[myarr]+2),3[1[myarr]]);
A. 6 66 777
B. 6 77 667
C. 5 66 777
D. 7 77 666
Ans: B
Explanation: -
Question Type: Moderate
#include<stdio.h>
void main(){
int array[2][3]={5,10,15,20,25,30};
int (*ptr)[2][3]=&array;
printf("%d\t",***ptr);
printf("%d\t",***(ptr+1));
printf("%d\t",**(*ptr+1));
printf("%d\t",*(*(*ptr+1)+2));
A. 5 Garbage value 20 30
B. 5 15 20 25
C. 10 20 30 30
D. 5 15 20 30
Ans: A
Explanation: -
Question Type: Difficult
#include<stdio.h>
void main(){
int* (*arr[2])[2]={&arr1,&arr2};
A. 2 4
B. 4 2
C. 4 8
D. 8 4
Ans: C
Explanation: -
Question Type: Moderately Easy
#include<stdio.h>
#include<math.h>
double myfun(double);
void main(){
double(*array[3])(double);
array[0]=exp;
array[1]=sqrt;
array[2]=myfun; printf("%.1f\t",(*array)((*array[2])((**(array+1))(4))));
}
double myfun(double d){
d-=1;
return d;
A. 1.4
B. 2.8
C. 4.2
D. 2.7
Ans: D
Explanation: -
Question Type: Moderate
#include<stdio.h>
#include<math.h>
typedef struct{
char *name;
double salary;
}job;
void main(){
int x=5;
job * arr[3]={&a,&b,&c};
printf("%s %f\t",(3,x>>5-4)[*arr]);
d-=1;
return d;
}
A. Google 35000.000000
B. TCS 15000.000000
C. IBM 25000.000000
D. null 15000.000000
Ans: A
Explanation: -
Question Type: Difficult
#include<stdio.h>
void main(){
int a=5,b=10,c=15;
int *arr[3]={&a,&b,&c};
printf("%d",*arr[*arr[1]-8]);
A. 5
B. 10
C. 18
D. Compilation error
Ans: D
Explanation: -
Question Type: Moderate
#include<stdio.h>
void main(){
int arr[][3]={{1,2},{3,4,5},{5}};
printf("%d %d %d",sizeof(arr),arr[0][2],arr[1][2]);
}
A. 6 04
B. 6 15
C. 18 05
D. 18 15
Ans: C
Explanation: -
Question Type: Easy
#include<stdio.h>
void main(){
int xxx[10]={5};
printf("%d %d",xxx[1],xxx[9]);
A. 0 5
B. 5 5
C. 5 0
D. 0 0
Ans: D
Explanation: -
Question Type: Easy
#include<stdio.h>
void main(){
long double a;
signed char b;
int arr[sizeof(!a+b)];
printf("%d",sizeof(arr))
A. 8
B. 9
C. 1
D. 4
Ans: D
Explanation: -
Question Type: Moderately Difficult
A. system dependent.
C. compiler dependent.
Ans: C
Explanation: -
Question Type: Easy
Ans: C
Explanation: -
Question Type: Easy
20. Identify the incorrect declaration of arrays from the following
A. int a[50];
B. float values[10][20];
C. double a[50];
D. int score[10,15];
Ans: D
Explanation: -
Question Type: Easy
Ans: C
Explanation: -
Question Type: Moderately Easy
A. value.
B. reference.
Ans: C
Explanation: -
Question Type: Easy
23. An array a[8] will store how many values ?
A. 8
B. 7
C. 9
D. 0
Ans: A
Explanation: -
Question Type: Easy
A. a[1] to a[10].
B. a[1] to a[9].
C. a[0] to a[9].
D. a[0] to a[10].
Ans: C
Explanation: -
Question Type: Moderate
int main(void)
int array[2][2][3]={0,1,2,3,4,5,6,7,8,9,10,11};
printf("%d",array[1][0][2]);
return 0;
A. 5
B. 6
C. 7
D. 8
Ans: D
Explanation: -
Question Type: Difficult
Portion - End Sem
Unit - IV
1. What is the output of this C code?
#include <stdio.h>
int main()
{
char *p = NULL;
char *q = 0;
if (p)
printf(" p ");
else
printf("nullp");
if (q)
printf("q\n");
else
printf(" nullq\n");
}
A. nullp nullq
B. Depends on the compiler
C. x nullq where x can be p or nullp depending on the value of NULL
D. p q
Ans: A
Explanation: -
Question Type: Difficult
#include <stdio.h>
int *f();
int main()
{
int *p = f();
printf("%d\n", *p);
}
int *f()
{
int j = 10;
return &j;
}
A. 10
B. Compile time error
C. Segmentation fault/runtime crash
D. Undefined behavior
Ans: A
Explanation: -
Question Type: Difficult
10. An array of similar data types which themselves are collection of dissimilar data type are
called ___________.
A. Linked Lists
B. Trees
C. Array of Structure
D. All of the mentioned
Ans: C
Explanation: -
Question Type: Moderately Easy
#include<stdio.h>
union Point
{
unsigned int x:4;
unsigned int y:4;
int res;
};
int main()
{
union Point pt;
pt.x = 2;
pt.y = 3;
pt.res = pt.y;
return 0;
}
// Output: The value of res = 3
Question Type: Moderate
23. One of elements of a structure can be a pointer to the same structure. State true or false.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderate
25. The . (DOT) operator can be used access structure elements using a structure variable.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Easy
27. A structure can contain similar or dissimilar elements. State true or false.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Easy
28. The -> operator can be used to access structures elements using a pointer to a structure
variable only. State true or false.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Easy
29. Which of the following statements correct about the below program?
#include<stdio.h>
int main()
{
struct emp
{
char name[25];
int age;
float sal;
};
struct emp e[2];
int i=0;
for(i=0; i<2; i++)
scanf("%s %d %f", e[i].name, &e[i].age, &e[i].sal);
30. Which of the following statements correctly assigns 12 to month using pointer variable pdt?
#include<stdio.h>
struct date
{
int day;
int month;
int year;
};
int main()
{
struct date d;
struct date *pdt;
pdt = &d;
return 0;
}
A. pdt.month = 12
B. &pdt.month = 12
C. d.month = 12
D. pdt->month = 12
Ans: D
Explanation: -
Question Type: Moderate
31. Which of the following statements correct about the below code?
maruti.engine.bolts=25;
A. Structure bolts is nested within structure engine.
B. Structure engine is nested within structure maruti.
C. Structure maruti is nested within structure engine.
D. Structure maruti is nested within structure bolts.
Ans: B
Explanation: -
Question Type: Moderately Easy
38. Ifa variable is a pointer to a structure, then which of the following operator is used to access
data members of the structure through the pointer variable?
A. . (dot)
B. &
C. *
D. ->
Ans: D
Explanation: -
Question Type: Moderately Easy
39. What would be the equivalent pointer expression for referring the array element a[i][j][k][l]?
A. ((((a+i)+j)+k)+l)
B. *(*(*(*(a+i)+j)+k)+l)
C. (((a+i)+j)+k+l)
D. ((a+i)+j+k+l)
Ans: B
Explanation: -
Question Type: Difficult
41. The operator used to get value at address stored in a pointer variable is_______.
A. *
B. &
C. &&
D. ||
Ans: A
Explanation: -
Question Type: Moderately Easy
45. What will be the output of the program If the integer is 4bytes long?
#include<stdio.h>
int main()
{
int ***r, **q, *p, i=8;
p = &i;
q = &p;
r = &q;
printf("%d, %d, %d\n", *p, **q, ***r);
return 0;
}
A. 8, 8, 8
B. 4000, 4002, 4004
C. 4000, 4004, 4008
D. 4000, 4008, 4016
Ans: A
Explanation: -
Question Type: Moderately Difficult
49. What will be the output of the program if the size of pointer is 4-bytes?
#include<stdio.h>
int main()
{
printf("%d, %d\n", sizeof(NULL), sizeof(""));
return 0;
}
A. 2, 1
B. 2, 2
C. 4, 1
D. 4, 2
Ans: C
Explanation: -
Question Type: Moderately Difficult
52. What will be the output of the program assuming that the array begins at the location 1002
and size of an integer is 4 bytes?
#include<stdio.h>
int main()
{
int a[3][4] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
printf("%u, %u, %u\n", a[0]+1, *(a[0]+1), *(*(a+0)+1));
return 0;
}
A. 448, 4, 4
B. 520, 2, 2
C. 1006, 2, 2
D. Error
Ans: C
Explanation: -
Question Type: Moderately Difficult
55. If the size of integer is 4 bytes, what will be the output of the program?
#include<stdio.h>
int main()
return 0;
}
A. 10, 2, 4
B. 20, 4, 4
C. 16, 2, 2
D. 20, 2, 2
Ans: B
Explanation: -
Question Type: Moderate
56. Point out the compile time error in the program given below.
#include<stdio.h>
int main()
{
int *x;
*x=100;
return 0;
}
A. Error: invalid assignment for x
B. Error:suspicious pointer conversion
C. No error
D. None of these
Ans: C
Explanation: -
Question Type: Easy
60. In the following program add a statement in the function fun() such that address of a gets
stored in j?
#include<stdio.h>
int main()
{
int *j;
void fun(int**);
fun(&j);
return 0;
}
void fun(int **k)
{
int a=10;
/* Add a statement here */
}
A. **k=a;
B. k=&a;
C. *k=&a
D. &k=*a
Ans: C
Explanation: -
Question Type: Moderate
61. Which of the following statements correct about k used in the below statement?
char ****k;
A. k is a pointer to a pointer to a pointer to a char
B. k is a pointer to a pointer to a pointer to a pointer to a char
C. k is a pointer to a char pointer
D. k is a pointer to a pointer to a char
Ans: B
Explanation: -
Question Type: Moderately Easy
63. In the following program add a statement in the function fact() such that the factorial gets
stored in j.
#include<stdio.h>
void fact(int*);
int main()
{
int i=5;
fact(&i);
printf("%d\n", i);
return 0;
}
void fact(int *j)
{
static int s=1;
if(*j!=0)
{
s = s**j;
*j = *j-1;
fact(j);
/* Add a statement here */
}
}
A. j=s;
B. *j=s;
C. *j=&s;
D. &j=s;
Ans: B
Explanation: -
Question Type: Moderate
65. Are the three declarations char **apple, char *apple[ ], and char apple[ ][ ] same?
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderate
67. The following statements are one of the correct ways for NULL pointer assignment. State true
or false.
int i=0;
char *q=(char*)i;
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Easy
68. The NULL pointer same as an uninitialised pointer. State true or false.
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
78. main()
{
char s[ ]="man";
int i;
for(i=0;s[ i ];i++)
printf("\n%c%c%c%c",s[
i ],*(s+i),*(i+s),i[s]);
}
A. mmmm
aaaa
nnnn
B. mmm
aa
nn
C. mmm
a
n
D. man
mma
nna
Ans: A
Explanation: s[i],
*(i+s), *(s+i), i[s] are all different ways of expressing the same idea. Generally
array name is the base address for that array. Here s is the base address. i is the index
number/displacement from the base address. So, indirecting it with * is same as s[i]. i[s] may be
surprising. But in the case of C it is same as s[i].
Question Type: Moderate
79. main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j,*p=c,*q=c;
for(j=0;j<5;j++) {
printf(" %d ",*c);
++q; }
for(j=0;j<5;j++){printf(" %d ",*p);
++p; }
}
A. 2 2 2 2 2 3 4 5 7
B. 2 2 2 2 2 2 3 4 6 5
C. 2 2 2 2 6 7
D. 7 6 5 2 1 2
Ans: B
Explanation: Initially
pointer c is assigned to both p and q. In the first loop, since only q is
incremented and not c , the value 2 will be printed 5 times. In second loop p itself is incremented.
So the values 2 3 4 6 5 will be printed.
Question Type: Moderate
84. Which of the following comment about the usage of structures in true?
A. Storage class can be assigned to individual member
B. Individual members can be initialized within a structure type declaration
C. The scope of the member name is confined to the particular structure, within which it is
defined
D. None of above
Ans: C
Explanation: Structure is user defined data type which is used to store heterogeneous data under
unique name.
Question Type: Moderate
93. The correct syntax to access the member of the ith structure in the array of structures is?
Assuming: struct temp
{
int b;
}s[50];
A. s.b.[i];
B. s.[i].b;
C. s.b[i];
D. s[i].b;
Ans: D
Explanation: -
Question Type: Moderate
96. What is the correct syntax to declare a function foo() which receives an array of structure in
function?
A. void foo(struct *var);
B. void foo(struct *var[]);
C. void foo(struct var);
D. None of the mentioned
Ans: A
Explanation: -
Question Type: Moderately Easy
4. Naming a file that has the ability to perform basic file operations
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Difficult
5. __________________ is the function name which is used to open an existing file for use
A. fclose
B. fopen
C. ftell
D. None of the above
Ans: B
Explanation: -
Question Type: Moderate
6. __________________ is the function name which is used to read the set of values from the file.
A. fscanf()
B. fprintf()
C. rewind()
D. putc()
Ans: A
Explanation: -
Question Type: Moderately Easy
8. __________________ is the function name which is used to sets the position to the beginning of the
file.
A. rewind()
B. rewind()
C. putw
D. None of the above
Ans: A
Explanation: -
Question Type: Difficult
9. __________________ is the function name which is used to give the current position in the file.
A. fseek()
B. ftell()
C. putw()
D. none of the ab
Ans: B
Explanation: -
Question Type: Difficult
10. __________________ is the function name which is used to reads the integer from a file
A. getw()
B. putw()
C. fseek()
D. none of the above
Ans: A
Explanation: -
Question Type: Difficult
11. __________________ is a string of characters that make up a valid name for the operating systems.
A. textname
B. dataname
C. filename
D. none of the above
Ans: C
Explanation: -
Question Type: Moderately Difficult
12. __________________ is the mode to open the file for reading only
A. r
B. w
C. a
D. none of the above
Ans: A
Explanation: -
Question Type: Easy
13. __________________ is the mode to open the file for appending data to it.
A. Save
B. Close
C. Minimized
D. None of the above
Ans: B
Explanation: -
Question Type: Difficult
14. A file is opened with mode w and file pointer fp1 then the statement will be as __________________
.
A. putc(c,fp 1);
B. putw(c,fp 1);
C. putc(w,fp 1);
D. putw(c,fp 1);
Ans: A
Explanation: -
Question Type: Difficult
16. fprintf is the function to perform I/O operations that are identical to familiar printf anf scanf.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Difficult
17. fscanf is the function to perform I/O operations that are identical to familiar printf anf scanf.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Difficult
18. fprint(fp,”control
string”,list); where fp is a__________________ associated with a file that has been
completed for writing.
A. Filepointer
B. fileindex
C. fileconstant
D. none of the above
Ans: A
Explanation: -
Question Type: Moderately Difficult
21. __________________ statement is the meaning to go to the end of the file, past the last character of
the file.
A. fseek(fp,0L,0)
B. fseek(fp,0L,2)
C. fseek(fp,-m,1)
D. none of the above
Ans: B
Explanation: -
Question Type: Moderately Difficult
23. Every C program must have one __________________ function and that marks the beginning of the
program.
A. Library function
B. Main function
C. Keywords
D. None of the above
Ans: C
Explanation: -
Question Type: Moderately Easy
24. The __________________ is an argument vector and represents an array of character pointers that
point to the command line arguments.
A. argc
B. argh
C. argv
D. None of the above
Ans: C
Explanation: -
Question Type: Moderate
25. __________________ is a program that processes the source code before it passes through the
compiler.
A. preprocessor
B. alt+f9
C. hash functions
D. none of the above
Ans: A
Explanation: -
Question Type: Easy
{
char title[20];
char author[15];
int pages;
float price;
}
The keyword struct declare the structure to hold the details of the four fields are called
__________________.
A. Struct
B. Structure elements
C. Book_bank
D. None of the above
Ans: B
Explanation: -
Question Type: Difficult
39. The ANSI standard permits initialization of structure variables with __________________ storage
class.
A. Auto
B. Static
C. Struct
D. None of the above
Ans: A
Explanation: -
Question Type: Moderately Difficult
41. __________________ operation return 1 if all the members are not equal , 0 otherwise.
A. Person 1 == person 2
B. Person 1 = person 2
C. Person 1 != person 2
D. None of the above
Ans: C
Explanation: -
Question Type: Moderately Easy
42. There are __________________ methods by which the values of a structure can be transferred from
one function to another.
A. One
B. Two
C. Three
D. Four
Ans: C
Explanation: -
Question Type: Easy
43. __________________ are the concept borrowed from structure and therefore follow the same
syntax as structures.
A. Union
B. Pointers
C. Preprocessors
D. None of the above
Ans: A
Explanation: -
Question Type: Moderate
45. In bit field the first bit will always starts with the __________________of the word.
A. First bit
B. Second bit
C. Third bit
D. Fourth bit
Ans: A
Explanation: -
Question Type: Moderately Difficult
47. Trying to read beyond the end-of-file mark is not an error handling during I/O operations.
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Easy
48. Rewind()fp;
N=ftell(fp);
__________________ takes a file pointer and resets the position to the start of the file.
A. pointer
B. rewind
C. fseek
D. fputc
Ans: B
Explanation: -
Question Type: Difficult
49. If we attempt to move the file pointer beyond the file boundaries, an error occurs and fseek function
returns __________________.
A. +1
B. +2
C. -1
D. -1
Ans: C
Explanation: -
Question Type: Moderate
52. If(ferror(fp)!=0)
53. __________________. Takes a file pointer and returns a number of type long.
A. fseek
B. frewind
C. ftell
D. None of the above
Ans: C
Explanation: -
Question Type: Easy
54. __________________ is the name of the file where executable code of the program is stored.
A. Structure
B. Program
C. Main
D. None of the above
Ans: B
Explanation: -
Question Type: Easy
56. When trying to open a file, one of the following things may happen.
When the mode is ‘writing’, a file with specified name is created if the file does not exist. The contents
are deleted if the file already exists
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderate
57. Attempting to write to a write-protected file is a error handling during I/O operation.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
58. Whenever a file is opened using __________________ a file pointer is returned.
A. fopen
B. fileopen
C. foef
D. None of the above
Ans: A
Explanation: -
Question Type: Moderately Difficult
59. __________________ data structures provides flexibility in adding , deleting or rearranging data
items at run time
A. Dynamic
B. Static
C. Buffer
D. None of the above
Ans: A
Explanation: -
Question Type: Moderate
62. What will the SWAP macro in the following program be expanded to on
preprocessing? will the code compile?
#include<stdio.h>
int main()
return 0;
}
A. It
compiles
B. Compiles with an warning
C. Not compile
D. Compiles and print nothing
Ans: C
Explanation: -
Question Type: Moderately Difficult
64. In a file contains the line "I am a boy\r\n" then on reading this line into the array
strusing fgets(). What will str contain?
A. "I am a boy\r\n\0"
B. I am a boy\r\0"
C. "I am a boy\n\0"
D. "I am a boy"
Ans: C
Explanation: -
Question Type: Moderately Easy
65. What is the purpose of "rb" in fopen() function used below in the code?
FILE *fp;
fp = fopen("source.txt", "rb");
A. open "source.txt" in binary mode for reading
B. open "source.txt" in binary mode for reading and writing
C. Create a new file "source.txt" for reading and writing
D. None of above
Ans: A
Explanation: -
Question Type: Moderate
67. Whichof the following operations can be performed on the file "NOTES.TXT" using
the below code?
FILE *fp;
fp = fopen("NOTES.TXT", "r+");
A. Reading
B. Writing
C. Appending
D. Read and Write
Ans: D
Explanation: -
Question Type: Moderately Easy
68. To print out a and b given below, which of the following printf() statement will you
use?
#include<stdio.h>
float a=3.14;
double b=3.14;
69. To scan a and b given below, which of the following scanf() statement will you use?
#include<stdio.h>
float a;
double b;
A. scanf("%f %f", &a, &b);
B. scanf("%Lf %Lf", &a, &b);
C. scanf("%f %Lf", &a, &b);
D. scanf("%f %lf", &a, &b);
Ans: D
Explanation: -
Question Type: Moderate
75. Names of functions in two different files linked together must be unique
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Difficult
76. Which of the following function sets first n characters of a string to a given
character?
A. strinit()
B. strnset()
C. strset()
D. strcset()
Ans: B
Explanation: -
Question Type: Moderately Easy
77. Ifthe two strings are identical, then strcmp() function returns
A. -1
B. 1
C. 0
D. Yes
Ans: C
Explanation: -
Question Type: Easy
78. Which of the following function is used to find the first occurrence of a given
string in another string?
A. strchr()
B. strrchr()
C. strstr()
D. strnset()
Ans: C
Explanation: -
Question Type: Moderately Easy
79. Which of the following function is more appropriate for reading in a multi-
word string?
A. printf();
B. scanf();
C. gets();
D. puts();
Ans: C
Explanation: -
Question Type: Moderately Difficult
80. The macro va_arg is used to extract an argument from the variable
argument list and advance the pointer to the next argument.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderate
81. The maximum combined length of the command-line arguments including the spaces
between adjacent arguments is_______________.
A. 128 characters
B. 256 characters
C. 67 characters
D. It may vary from one operating system to another
Ans: D
Explanation: -
Question Type: Easy
82. Every time we supply new set of values to the program at command prompt, we need
to recompile the program.
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Moderately Difficult
83. Even if integer/float arguments are supplied at command prompt they are treated as
strings.
A. True
B. False
C. -
D. -
Ans: A
Explanation: -
Question Type: Moderately Easy
84. The first argument to be supplied at command-line must always be count of total
arguments.
A. True
B. False
C. -
D. -
Ans: B
Explanation: -
Question Type: Easy
85. Property which allows to produce different executable for different platforms in C is
called?
A. File inclusion
B. Selective inclusion
C. Conditional compilation
D. Recursive macros
Ans: C
Explanation: -
Question Type: Moderate
88. Preprocessor feature that supply line numbers and filenames to compiler is called?
A. Selective inclusion
B. macro substitution
C. Concatenation
D. Line control
Ans: D
Explanation: -
Question Type: Moderately Difficult
89. #include are _______ files and #include “somefile.h” ________ files
A. Library, Library
B. Library, user-created header
C. User-created header, library
D. They can include all types of file
Ans: D
Explanation: -
Question Type: Difficult
92. For binary files, a ___ must be appended to the mode string.
A. Nothing
B. “b”
C. “binary”
D. “01″
Ans: B
Explanation: -
Question Type: Moderately Easy
93. Ifthere is any error while opening a file, fopen will return ___________.
A. Nothing
B. EOF
C. NULL
D. Depends on compiler
Ans: C
Explanation: -
Question Type: Moderate
99. What is the size of array “line” used in fgets(line, maxline, *fp) function?
A. maxline -1
B. Maxline
C. maxline + 1
D. Size is dynamic
Ans: B
Explanation: -
Question Type: Difficult