QUES AND ANS

Sample C Programming Questions & Answers:

1. Comment on the output of following code:
  1.     #include <stdio.h>
  2.     main()
  3.     {
  4.         char *p = 0;
  5.         *p = 'a';
  6.         printf("value in pointer p is %c\n", *p);
  7.     }
a) It will print a
b) It will print 0
c) Compile time error
d) Run time error
View Answer
Answer:d
Output:
$ cc pgm.c
$ a.out
Segmentation fault (core dumped)
2. What is the output of this C code?
  1.    #include <stdio.h>
  2.    main()
  3.    {
  4.        if (sizeof(int) > -1)
  5.            printf("True");
  6.        else
  7.            printf("False");
  8.    }
a) True
b) False
View Answer
Answer:b
Output:
$ cc pgm.c
$ a.out
False
3. What is the output of this C code?
  1.     #include <stdio.h>
  2.     main()
  3.     {
  4.         char *p = "Sanfoundry C-Test";
  5.         p[0] = 'a';
  6.         p[1] = 'b';
  7.         printf("%s", p);
  8.     }
a) abnfoundry C-Test
b) Sanfoundry C-Test
c) Compile time error
d) Run time error
View Answer
Answer:d
Output:
$ cc pgm.c
$ a.out
Segmentation fault (core dumped)
4. What is the output of this C code?
  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         float f = 0.1;
  5.         if (f == 0.1)
  6.             printf("True");
  7.         else
  8.             printf("False");
  9.     }
a) True
b) False
View Answer
Answer:a
Output:
$ cc pgm.c
$ a.out
False
5. What is the output of this C code?
  1.     #include <stdio.h>
  2.     main()
  3.     {
  4.         int n = 0, m = 0;
  5.         if (n > 0)
  6.             if (m > 0)
  7.                 printf("True");
  8.         else 
  9.             printf("False");
  10.     }
a) True
b) False
c) No Output will be printed
d) Run Time Error
View Answer
Answer:c
Output:
$ cc pgm.c
$ a.out
$







  COMPUTER  GK QUESTION 





1. Pipelining strategy is called implement
 instruction execution
 instruction prefetch
 instruction decoding
 instruction manipulation
ANSWER : instruction prefetch
2. In MS-DOS you can use small or capital letter of combination of both to enter a command but internally MS-DOS work with.
 Small letter
 Capital letter
 Both a and b
 None of above
ANSWER : Capital letter
3. Terminals are required for
eal-time, batch processing & time-sharing
eal time, time-sharing & distributed message processing
eal time, distributed processing & manager inquiry
eal-time, time sharing & message switching
ANSWER : real-time, time sharing & message switching
4. To copy the file command.com from drive c: to drive a:
 Drive c: copy drive a:\command.com
 C:A: copy command.com
 Copy c:\command.com a:
 Both b and c
ANSWER : Copy c:\command.com a:
5. Electronic spreadsheets are most useful in a situation where relatively .... data must be input but ...... calculations are requied.
 little; simple
 large; simple
 large; complex
 little; complex
ANSWER : little; complex
6. A collection of 8 bits is called
 byte
 word
 record
 All of above
ANSWER : byte
7. Which of the following is not one of the process that a high level language program msut go through before it is ready to be executed?
 translation
 controlling
 lading
 linking
ANSWER : translation
8. While working with Ms-Dos which command transfers a specific file from one disk to another?
 Copy
 Diskcopy
 Time
 Rename
ANSWER : Copy
9. The vol command is used to
 see the value of list
 see the veriety of language
 see the disk volume label
 see the volume of largest
ANSWER : see the disk volume label
10. Disk copy command in DOS is used to
 Copy a file
 Copy contents of one floppy disk to another
 Copy contents of CD-ROM to another
 All of the above
ANSWER : Copy contents of one floppy disk to another
11. All computers execute
 BASIC programs
 COBOL programs
 Machine language program
 FORTRAN programs
ANSWER : Machine language program
12. Interrupts which are initiated by an instruction are
 internal
 external
 hardware
 software
ANSWER : external
13. The branch logic that provides decision making capabilities in the control unit is known as
 controlled transfer
 conditional transfer
 unconditional transfer
 none of above
ANSWER : unconditional transfer
14. Processors of all computers, whether micro, mini or mainframe must have
 ALU
 Primary Storage
 Control unit
 All of above
ANSWER : All of above
15. An example of digital, rather than analog, communication is
DD
DS
ATS
DT
16. External command in DOS are
 Copy, edit, sys, format
 Edit, sys, chkdsk
 Chkdsk, prompt, date
 Sys, ver, vol
ANSWER : Edit, sys, chkdsk

17. Pipeline implement
 fetch instruction
 decode instruction
 fetch operand
 all of abve
ANSWER : all of abve
18. The ALU and control unit of most of the microcomputers are combined and manufacture on a single silicon chip. What is it called?
 monochip
 microprocessor
 ALU
 control unit
ANSWER : microprocessor
19. What is the control unit's function in the CPU?
 To transfer data to primary storage
 to store program instruction
 to perform logic operations
 to decode program instruction
ANSWER : to decode program instruction
20. Which of the following performs modulation and demodulation?
 fiber optics
 satellite
 coaxial cable
 modem
ANSWER : modem
21. Which of hte following is considered a broad band communication channel?
 coaxial cable
 fiber optics cable
 microwave circuits
 all of above
ANSWER : all of above
22. The interactive transmission of data within a time sharing system may be best suited to
 simplex lines
 half-duplex lines
 full duplex lines
 biflex-lines
ANSWER : half-duplex lines
23. Which of the following is most oriented to scientific programming?
 FORTRAN
 COBOL
 BASIC
 PL/1
ANSWER : FORTRAN
24. To copy the hidden system files of DOS to another disk you can use the command
 Copy
 Ren
 Sys
 Diskcopy
ANSWER : Sys
25. In BASIC, description comments are put in the source program with the
 PRINT statement
 REMARK statement
 INPUT statement
 DATA statement
ANSWER : REMARK statement
26. Which command is used to display all the files having the (.exe) extension but different filename?
 Dir filename.*
 Dir filename.ext
 Dir *.sys
 Dir *.ext
ANSWER : Dir *.ext
27. CHKDSK command is used to
 Analyze the hard disk error
 Diagnose the hard disk error
 Report the status of files on disk
 All of the above
ANSWER : All of the above
28. In which year the first operating system was developed
 1910
 1940
 1950
 1980
ANSWER : 1950
29. Which command should be used to display all files within the specified subordinate directory of the subdirectory?
 Dir \ pathname
 Dir \ pathname\pathname
 Dir / ch
 Dir \pathname\filename
ANSWER : Dir \pathname\pathname
30. In communication satellite, multiple repeaters are known as
 detector
 modulator
 stations
 transponders
ANSWER : transponders
31. Which of the following is an advantage to using fiber optics data transmission?
 resistance to data theft
 fast data transmission rate
 low noise level
 all of above
ANSWER : all of above
32. The channel in the data communication model can be
ostal mail services
elephone lines
adio lines
ny of the above
ANSWER : any of the above
33. Which of the following statement is incorrect?
 Multiplexers are designed to accept data from several I/O devices and transmit a unified stream of data on one communication line
 HDLC is a standard synchronous communication protocol.
 RTS/CTS is the way the DTE indicates that it is ready to transmit data and the way the DCW indicates that it is ready to accept data
 RTS/CTS is the way the terminal indicates ringing
ANSWER : RTS/CTS is the way the terminal indicates ringing
34. The process of converting analog signals into digital signals so they can be processed by a receiving computer is referred to as:
 modulation
 demodulation
 synchronizing
 digitizing
ANSWER : digitising
35. In OSI network architecture, the dialogue control and token management are responsibility of
 session layer
 network layer
 transport layer
 data link layer
ANSWER : session layer
36. Which of the following types of channels moves data relatively slowly?
 wide band channel
 voice band challen
 narrow band channel
 none of above
ANSWER : narrow band channel
37. Which file organization is allowed by a direct access storage device?
 direct only
 sequential and direct only
 indexed and direct only
 sequential, indexed and direct
ANSWER : sequential, indexed and direct
38. If you need to duplicate the entire disk, which command will you use?
 Copy
 Diskcopy
 Chkdsk
 Format
ANSWER : Diskcopy
39. A data terminal serves as an
ffector
ensor
oth a and b
either a nor b
ANSWER : both a and b
40. Which command displays the directory list including files in tree structure?
 Dir/s/f
 Tree/f
 Tree/s/f
 Dir/f
ANSWER : Tree/f
41. A complete microcomputer system consists of
 microprocessor
 memory
 peripheral equipment
 all of above
ANSWER : all of above
42. Which of the following code is used in present day computing was developed by IBM corporation?
 ASCII
 Hollerith Code
 Baudot code
 EBCDIC code
ANSWER : EBCDIC code
43. All of the following are divisions of the COBOL program except:
 input-output
 indentification
 procedure
 data
ANSWER : input-output
44. Which command be used to clear the screen and display the operating system prompt on the first line of the display?
 Cd
 Md
 Rename
 cls
ANSWER : cls
45. Avalanche photodiode receivers can detect bits of transmitted data by receiving
 100 photons
 200 photons
 2000 photons
 300 photons
ANSWER : 200 photons
46. MS-DOS developed in
 1991
 1984
 1971
 1961
ANSWER : 1984
47. The synchronous modems are more costly than the asynchronous modems because
 they produce large volume of data
 they contain clock recovery circuits
 they transmit the data with stop and start bits
 they operate with a larger bandwidth
ANSWER : they contain clock recovery circuits
48. Which command is used to make a new directory?
 Md
 Cd
 Rd
 None of above

56. What is the main difference between DDCMP and SDLC?
DCMP does not need special hardware to final the beginning of a message
DCMP has a message header
DLC has a IP address
DLC does not use CRC
ANSWER : DDCMP does not need special hardware to final the beginning of a message

55. One disadvantage of a direct access file is:
 the delay in computiong the storage address
 duplication of address locations
 unsued, but available, storage locations
 all of above
ANSWER : the delay in computiong the storage address

54. CHKDSK can be used to find
 Disk’s bad portion
 Occupied space
 Free space
 All of above
ANSWER : All of above

ANSWER : Md
49. Which of the following communications lines is best suited to interactive processing applications?
 narrow band channel
 simplex lines
 full duplex lines
 mixed band channels
ANSWER : full duplex lines
50. In a synchronous modem, the receive equilizer is known as
daptive equilizer
mpariment equilizer
tatistical equilizer
ompromise equilizer
ANSWER : adaptive equilizer
51. Maximum length of DOS command using any optional parameter is
 26 characters
 87 characters
 127 characters
 None of above
ANSWER : 127 characters
52. xcopy command can copy
 individual files or group of files
 directories including subdirectories
 to diskette of a different capacity
 all of above
ANSWER : all of above
53. What is the number of separate protocol layers at the serial interface gateway specified by the X.25 standard?
 4
 2
 6
 3
ANSWER : 3
54. CHKDSK can be used to find
 Disk’s bad portion
 Occupied space
 Free space
 All of above
ANSWER : All of above
55. One disadvantage of a direct access file is:
 the delay in computiong the storage address
 duplication of address locations
 unsued, but available, storage locations
 all of above
ANSWER : the delay in computiong the storage address
56. What is the main difference between DDCMP and SDLC?
DCMP does not need special hardware to final the beginning of a message
DCMP has a message header
DLC has a IP address
DLC does not use CRC
ANSWER : DDCMP does not need special hardware to final the beginning of a message
More Computer Basics GENERAL KNOWLEDGE QUESTIONS AND ANSWERS available in next pages

No comments:

Post a Comment