Programming in 'c' MCQ 22226 (PCI) with answers| | Msbte I scheme
1) Who invented C Language.?
A) Charles Babbage
B) Grahambel
C) Dennis Ritchie
D) Steve Jobs
Ans- C)
Explanation:
Full name is Dennis MacAlistair Ritchie. He also invented Unix Operating System along with his colleague Ken Thomson.
2) C Language is a successor to which language.?
A) FORTRAN
B) D Language
C) BASIC
D) B Language
Ans- C)
3) C is a which level language.?
A) Low Level
B) High Level
C) Low + High
D) None
Ans-B)
Explanation:
C is a high level language. Another example is BASIC.
4) Low level language is .?
A) Human readable like language.
B) language with big program size.
C) language with small program size.
D) Difficult to understand and readability is questionable.
Ans:D)
Explanation:
Looks like raw data often in the form of 1's and 0's.
5) High level language is a.?
A) Human readable like language.
B) language with small program size.
C) language with big program size.
D) language which is difficult to understand and not human readable.
Ans: A)
Explanation:
Examples are C and BASIC.
6) Which program outputs "Hello World.." .?
A)
main()
{
scanf("Hello World..");
}
B)
main()
{
printf("Hello World..");
}
C)
main()
{
print("Hello World..");
}
D)
main()
{
scan("Hello World..");
}
Ans: B)
7) C is _______ type of programming language.?
A) Object Oriented
B) Procedural
C) Bit level language
D) Functional
Ans:B
Explanation:
C is a procedural language. It is written in a number of steps using statements and functions. Logic is clearly depicted in the program. Procedural language is aslo called Imperative Language. Examples are COBAL, BASIC etc.
8) What is the present C Language Standard.?
A) C99 ISO/IEC 9899:1999
B) C11 ISO/IEC 9899:2011
C) C05 ISO/IEC 9899:2005
D) C10 ISO/IEC 9899:2010
Ans: B)
9) What are the new features of C11 or ISO IEC 9899 2011 standard.?
A) Type generic Macros, Static Assertions
B) Multi Threading, Anonymous Unions, quick_exit
C) Bounds Checking Interfaces, Anonymous Strurctures
D) All
Ans: D)
10) C language was invented in which laboratories.?
A) Uniliver Labs
B) IBM Labs
C) AT&T Bell Labs
D) Verizon Labs
Ans: C)
Explanation:
C was invented in Bell Laboratories in New Jersey.
11) BCPL Language is also called..?
A) C Language
B) B Language
C) D Language
D) None
Ans: D)
Explanation:
B language is successor of BCPL ( Basic Combned Programming Language ). B language was invented by Ken Thomson.
12) C language was invented to develop which Operating System.?
A) Android
B) Linux
C) Ubuntu
D) Unix
Ans: D)
Explanation:
C was invented to develop Unix Operating System to overcome compatibility with different Hardware Platforms.
13) C language was invented in the year.?
A) 1999
B) 1978
C) 1972
D) 1990
Ans: c)
14) C language is used in the development of .?
A) Databases
B) Graphic applications
C) Word Processors
D) All of the above
Ans: D)
Explanation:
C language is very efficient in using hardware resources.
15) A C program is a combination of.?
A) Statements
B) Functions
C) Variables
D) All of the above
Ans: D)
16) Choose correct answer..
#include<stdio.h>
main()
{
/* Multi Line Comment
This line is ignored by compiler
*/
printf("Hello C..");
}
A) #include is a Preprocessor Directive
B) <stdio.h> is a header file with predefined functions like printf, scanf etc
C)
#include
main()
{
}
is a mandatory function to be included in every C Program.
D) All the above
Ans: D)
17) Correct way of commenting a single line is.?
A) /*printf("Hello C.."); printf("How are you.");
B) //printf("Hello C.."); printf("How are you.");
C) /*printf("Hello C.."); printf("How are you.");*/
D) /printf("Hello C..");/ printf("How are you.");
Ans: B)
Explanation:
Answer C comments two lines with Multi-Line comment or BLOCK Comment characters /* ....*/
Only // is a Single Line Commenting characters.
18) What is an Identifier in C Language.?
A) Name of a Function or Variable
B) Name of a Macros
C) Name of Structure or Union
D) All the above.
Ans: D)
Explanation:
int age=25;
//here age is an Identifier
19) An Identifier may contain.?
A) Letters a-z, A-Z in Basic character set. Unicode alphabet characters other languages
B) Underscore _ symbol
C) Numbers 0 to 9 Unicode Numbers in other languages
D) All the above
Ans: D)
20) What is the number of characters used to distinguish Identifier or Names of Functions and Global variables.?
A) 31
B) 32
C) 33
D) 28
Ans: A)
Explanation:
First 31 characters in general. If first 31 characters are same for two different identifiers, compiler gets confused.
21) What is length of an Identifier that is unique for Non-Global Variables and Non-Function Names.?
A) 32
B) 63
C) 64
D) 68
Ans: B)
Explanation:
if 31 is present choose. Because old compilers support up to 31 only.
Upto first 63 characters you can show differentiation in the name of say
int abcdefghijklmnopqrstuvwxyz1234567788= 10;
int abcdefghijklmnopqrstuvwxyz1234567799 = 20;
22) An Identifier can start with.?
A) Alphabet
B) Underscore (_) sign
C) Any character that can be typed on a keyboard
D) Option A & Option B
Ans: D)
Explanation:
Identifier is just a name given to a Function, Variable etc.
Identifier name should contain only Letter, Numbers and Underscore.
23) C Programs are used in .?
A) Any Electronic device which works on some logic and Operating System.
B) Washing machine
C) Fridge, Microwave Ovens
D) All the above.
Ans: D)
Explanation:
C is very fast to execute and safe to embed along with microprocessors. Device drivers are written in C and C++.
24) What are the types of Constants in C Language.?
A) Primary Constants
B) Secondary Constants
C) Basic Constants and Advanced Constants
D) Primary Constants and Secondary Constants
Ans: D)
Explanation:
Primary Constants are Integer (int), Floating Point (float), Character (char)
Secondary Constants are Structure, Union, Array and Enum.
25) Choose correct statements
A) A constant value does not change. A variable value can change according to needs.
B) A constant can change its values. A variable can have one constant value only.
C) There is no restriction on number of values for constants or variables.
D) Constants and Variables cannot be used in a single main function.
Ans: A)
Explanation:
Constant value is always constant. Constant is also called Literal.
Variable can have any number of arbitrary values and once value at any point of time. Variable is also called Identifier.
26) Find an integer constant.
A) 3.145
B) 34
C) "125"
D) None of the above
Ans: B)
Explanation:
Integer constant is a full or whole number without any decimal point. So, 3.14 is a floating-point number or Real number.
27) Find a Floating-Point constant.
A) 12.3E5
B) 12e34
C) 125.34857
D) All the above.
Ans: D)
Explanation:
Floating Point can be represented in two forms.
1. Fractional Form
eg. 12345.67
2. Exponential Form
(Mantissa)e(number) or (Mantissa)E(number)
eg. 123.4567E2
(e2 = 10 power 2 = 100)
28) Find a Character constant.
A)
'A'
'a'
B)
'1'
'9'
C)
'$'
'#'
D) All the above.
Ans: D)
Explanation:
A character constant contains only one character within Single Quotes. ' '. Single Quote is typed using Single Quote Double Quote Key near Enter Key in a Keyboard. Simply it is Right Single Quote.
Left Single Quote looks like this `
Right Single Quote looks like this '
29) A Variable of a particular type can hold only a constant of the same type. Choose right answer.
A) TRUE
B) FALSE
C) It depends on the place the variable is declared.
D) None of the above.
Ans: A)
Explanation:
An int can hold only Integer constant.
A float can hold only Real Number constants.
A char can hold only Character constants.
30) Number of Keywords present in C Language are .?
A) 32
B) 34
C) 62
D) 64
Ans: A)
Explanation:
Only 32 Keywords originally. Compilers are individual companies can include and use extra keywords if required. Such keywords should preceed with __ ( two Underscore symbols before names).
eg. __mykeyword
Comments
Post a Comment