0% found this document useful (0 votes)
144 views

Computer Programming C MCQ and Answer

This document provides an overview of the Computer Programming 1303 tutorial center program offered through Chittagong University of Engineering & Technology. The program covers several units and lessons including objectives of computer programming, algorithms, flowcharts, pseudocodes, decision tables, structured diagrams, characteristics of programming languages, data elements, and data structures. It aims to teach students key concepts in computer programming through structured lessons and examples.

Uploaded by

Khalid Hossain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
144 views

Computer Programming C MCQ and Answer

This document provides an overview of the Computer Programming 1303 tutorial center program offered through Chittagong University of Engineering & Technology. The program covers several units and lessons including objectives of computer programming, algorithms, flowcharts, pseudocodes, decision tables, structured diagrams, characteristics of programming languages, data elements, and data structures. It aims to teach students key concepts in computer programming through structured lessons and examples.

Uploaded by

Khalid Hossain
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Diploma in Computer Science and

Application
(DCSA) Program

COMPUTER PROGRAMMING
1303

Tutorial Center

CHITTAGONG UNIVERSITY OF
ENGINEERING & TECHNOLOGY.

1 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
UNIT 1: UNIT 2
LESSON 1: Objectives of Computer Programming Lesson:3 Flowcharts-I

1. Which of the following languages came first? 1. Which one represents start and end blocks of a
a) Assembly b) C flowchart?
c) Pascal or C a) Ellipse
d) machine language.  b) Circle 
c) Rectangle
2. High level language can be developed from a) low d) Cone.
level language 
b) high level language c) assembly language 2. Which one is the process or operation block, that
d) C language. gives instructions for work to be done looks like?
a) Parallelogram b) Rhombus
3. Which of the following languages is nearest to c) Line
structured English? d)Rectangle. 
a) High level
b) Pascal or C 3. Which one is the decision block, that asks a
c) machine question and has two or move outputs looks like?
d) Macro assembler. a) Rhombus 
ANS: 1. d, 2. a, 3. B b) Circle
Lesson:2 Nature of Algorithms c) Point
d) Ellipse.
1. Which one of the following statement is true?
a) Algorithm is a part of programming ANS: 1. a, 2. d, 3. a
b) Algorithm is a part of system design
Lesson 4: Flowcharts-II
c) Algorithm is a part of problem solving
d) Algorithm is a part of system analysis.
1. Which of the following is the symbol of I/O?
2. Which one of the following statement is true? a) Rectangle b) Triangle c) Rhombus
a) An Algorithm is composed of finite number of step d) Parallelogram. 
sb) An Algorithm is composed of any number of steps
c) An Algorithm is composed of certain number of steps  2. Which one of the following statement is true for
d) An Algorithm is composed of infinite number of steps. looping?
a) not repeated
3. Which of the following is false? b) repeated several times 
a) Programming means translation of an algorithm into c) no use further
some machine code d) repeated only one time.
b) Programming means translation of an algorithm into
structured 3. Which of the following symbol is used for modular
English
c) Programming means translation of an algorithm into a
flowchart?
programming language  a) Rectangle with two sides double lined 
d) Programming means translation of an algorithm into C b) Parallelogram
programming language. c) Point
d) Quadruple.
4. Which of the following is true?
a) To design an efficient algorithm it is necessary to have ANS: 1. d, 2. b, 3. a Lesson 5: Pseudocodes
good knowledge in mathematics
b) To design an efficient algorithm it is necessary to have 1. Which one of the following statement is true?
good knowledge in software
c) To design an efficient algorithm it is necessary to have
a) Pseudocodes a narrative sentence b) Pseudocodes
clear theoretical background on the topic  a graphic symbol
d) To design an efficient algorithm it is necessary to have c) Pseudocodes structured English 
good knowledge d) Pseudocodes is the machine language.
in English.
5. Which of the following is suitable for expressing an 2. Which statement is used for termination of iteration
algorithm? structure in
a) Structured English  Pascale?
b) Machine language a) ENDFOR
c) C b) ENDIF
d) Pascal. c) ENDWHILE
ANS: 1. c, 2. a, 3. c, 4. c, 5. a d) DOWEND. 

2 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
3. How many structures of pseudo codes you have 4. What is represented by Warnier - Orr diagram?
found in this lesson? a) Program flow
a) 2 b) Output report 
b) 3 c) Arithmetic computation
c) 4 d) Flow chart.
d) 5.
5. Which of the following is used in Warnier-Orr
ANS : 1. c, 2. d, 3. b diagram?
a) Circle
Lesson 6: Decision Table b) Diamond c) Rectangle
d) Curly braces. 
1. How many words must be used for writing a
header? ANS: 1. a, 2. a, 3. c, 4. b, 5. d
a) 1 or 2 words
b) 3 or 4 words UNIT 3
c) 5 or 6 words Lesson8: Characteristics
d) 10 to 12 words. 1. Programming languages are usually divided into
two classes
2. Where are the action entries located? a) high level and low level languages 
a) lower left b) bottom left b) machine language and assembly languages
c) top right c) machine language and high level languages
d) bottom right portion of the decision table.  d) assembly language and fourth generation
languages.
3. In which case 'X' sign is used?
a) action entries  2. Which of the following is not high level language?
b) condition stub a) PASCAL
c) header b) C 
d) condition entry. c) Machine language d) LISP.

4. Which are satisfying the ignored condition? 3. Which one is developed to avoid major changes in
a) X written programme?
b) , a) high level languages 
c) -  b) low level languages
d) I. c) assembly
d) machine languages.
ANS : 1. b, 2. d, 3. a, 4. c
Lesson 7: Structured Diagram 4. Which of the following is not a characteristic of a high
1. Which one is true? level language?
a) Repetition is shown by the half circle a) portability
b) Repetition is shown by the full circle b) efficiency of use
c) Repetition is shown by the closed circle c) naturalness
d) none of the above in Warnier-Orr diagram. d) low productivity of programmers. 

2. Which one of the following statement is true? 5. Which one is known as translator of source
a) Structured chart is the previous state of algorithm programme into machine language?
design a) compilation
b) Structured chart is the previous state of data b) portability
structure c) execution
c) Structured chart is the previous state of system d) booting.
development ANS: 1. a, 2. c, 3. a, 4. d, 5. a
d) Structured chart is the previous state of program
design. LESSON 9: Data Elements

3. Which one supports the similarity of Warnier-Orr 1. How many types of standard data elements are
diagram and structured chart? there in C?
a) Repetition symbol a) 2 b) 3
b) Main structure c) 4 
c) Tree structure  d) 5.
d) Looping.

3 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
2. Which of the following statement is true?
a) Subrange type data elements form a subset of integer LESSON 11: Data Structure-II
data
b) Subrange type data elements form a subset of any 1. Which one is the valid?
ordered data a) A record is collection of data types
c) Subrange type data elements form a subset of any b) A record is collection of elements of different types
contiguous ordered data  
d) Subrange type data elements form a subset of data where c) A record is collection of array elements
each d) A record is collection of logical data elements.
3. Which of the following is not a standard data
2. Which one of the following statement is true?
element?
a) List a sequence of field
a) enumerated data
b) List a sequence of data types
b) integer
c) List a sequence of data items
c) real
d) List a sequence of characters.
d) Boolean.
3. Which one is valid?
4. Which one is valid?
a) Stack is accessible only from top
a) "2>3" integer
b) Stack is accessible only from bottom
b) "2>3" character
c) Stack is accessible insertion from top and deletion
c) "2>3" Boolean  from bottom d) Stack is accessible insertion from
d) "2>3" real data. bottom and deletion from top.
5. Which one of the following expression in Pascal is 4. Which one of the following statement is true?
valid? a) Queue is a data structure facilitating first in first
a) 24/5=4, 24 DIV 5=4 out 
b) 24/5=4, 24 DIV 5=4.8 b) Queue is a data structure facilitating last in last
c) 24/5=4.8, 24 DIV 5=4 Out
d) 24/5=5, 24 DIV 5=4.8. c) Queue is a data structure facilitating only deletion
d) Queue is a data structure facilitating only insertion
ANS: 1. c, 2. c, 3. a, 4. c, 5. c operations.
LesSon 10: Data Structure-I

1. Which next the following is the definition of data ANS: 1. b, 2. c, 3. a, 4. a


structure?
a) Data structure is a basic data type  UNIT 4
b) Data structure is a collection of basic data type c)
Data structure is a way of arranging data LESSON 12: Operators
d) Data structure is storing data.
1. Let x=4, y=5, x=++y. What is the value of (x,y)?
2. Which of the following statement is valid? a) 4,5 b) 4,6 c) 3,5
a) Generally the size of an array is fixed  d) 6,6. 
b) Generally the size of an array is dynamic
c) Generally the size of an array is both fixed and 2. Let x=4, y=5, x=y++. What is the value of (x,y)?
dynamic d) Generally the size of an array is up to a) 5,6
infinite. b) 5,5
c) 6,6
3. What does indicate a subscripted variable? d) 8,9.
a) address of specific data
b) memory element 3. Which is the false statement?
c) relative position of data from beginning a) Logical operators may be unary
d) Individual item of data.  b) Relational operators may be unary 
c) Arithmetic operators may be unary
4. Why does we use character storing data structure? d) Logical operators may be binary.
a) for representing numeric b) for representing ANS: 1. d, 2. a, 3. b
graphical
c) for representing logical
d) for representing a sequence of characters. 

ANS: 1. c, 2. a, 3. d, 4. d

4 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
LESSON 13: Precedence and Associativity 2. Which is a false statement?
a) Procedures decreases programming effort b)
1. Which one is equivalent to D/B*C+B? if the Procedures make programming modular
language supports left associative rule. c) Parameter passing is done by constants and
a) (B*C) + D/C variables 
b) *C+D/C d) Operators are substituted by procedures.
c) (C+D)/C
d) ((D/B)*C)+B.  3. In call by value convention the parameter is passed
a) arithmetic expression
2. When two operators of same precedence is found b) logical expression
in an expression then, which one is valid? c) variables
a) evaluation depends on precedence rule d) value. 
b) evaluation depends on arbitrarily 4. For call by reference the value of the parameter
c) evaluation depends on associatively rule  must be
d) evaluation depends on addition. a) expression
3. If the language supports left associative rule, What b) operator
is the value of 2*2/4+6-8-7? c) variable
a) -8  d) array. 
b) -9
c) 5 5. Consider the following procedure
d) 6. A = 2; B = 5;
PROCEDURE swap (X,Y) INTEGER X,Y;
ANS: 1. d, 2. c, 3. a BEGIN temp = X; X = Y;
LESSON 14: Statements Y = temp;
If procedure uses call by reference and swap (A,B) is
1. How many types of statements are there in a called what will be the value of A and B
programming language? a) 2,5
a) 5  b) 5,5
b) 4 c) 5,2 
c) 2 d) 2,2.
d) 8.
6. What happened if call by value is used?
2. In PASCAL compound statements are bounded by a) 2,5  b) 5,5 c) 5,2 d) 2,2.
a) left and right curly braces ANS: 1. a, 2. c, 3. d, 4. d, 5. c, 6. a
b) left and right braces
c) Begin, End and semicolon (;) UNIT 5
d) no special arrangement required. LESSON 16: Pascal Fundamentals-I

3. Which types of statements are not used for code 1. Most versions of PASCAL allow maximum string
generation? lengths of at least
a) I/O statements a) 255
b) Arithmetic statements b) 128
c) Declarative statements c) 8
d) Structural statements. d) 64 characters.

4. FOR and DO-WHILE loops are a) I/O 2. If a string includes an apostrophe, the apostrophe
b) Structural must beentered
c) Sequence control statements a) twice 
d) none of the above. b) once
c) with a quote sign
ANS: 1. a, 2. c, 3. c, 4. c d) surrounded by quote signs.

LESSON 15: Procedures and Functions 3. The following is an invalid real number. a) 0.0
1. Procedure decreases b) 5000.0067
a) programme size c) 1,00.08 
b) programme execution time c) compiling time d) -50.26e-18.
d) none of the above.

5 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
4. The quantity -5.021X 10-17 cannot be represented 3. All procedures do not have the following general
by characteristics:
a) -5.021E-17 a) A procedure is accessed by a simple statement
b) -.5021E-16 consisting of the procedure name followed by an
c) -5 0.21e-18 (optional) list of parameters.
d) -5,00.021e-19.  b) The parameters may represent information
supplied to the procedure or, under certain conditions,
5. The real number 5.E+11 is not valid because information returned bythe procedure.
a) there must be a digit on each side of the decimal c) Any number of data items can be transferred
point  between a procedure and its reference point (i.e., the
b) Decimal point should not be there statement that accesses the procedure).
c) + sign should not be there d) Procedure can be used in an expression like
d) 11 must be inside parentheses. function. 

6. The following is not a valid real number 4. The following is not a structured statement in
a) 8e2.3 PASCAL:
b) 0.021 a) Compound statements b) repetitive statements
c) -6.012E-22 d) 20.67895. c) conditional statements
d) assign a data item to a variable. 
ANS: 1. a, 2. a, 3. c, 4. d, 5. a, 6. a
LESSON 17: Pascal Fundamentals-II ANS: 1. a, 2. b, 3. d, 4. D UNIT 6
LESSON 19: Simple Data Type -I
1. The following is not a structured data type a)
Arrays 1. Which one of the following expression is correct?
b) records c) files a) x= x DIV y*y+x MOD y
d) integer. b) x= (x DIV y)*y+(x MOD y) 
c) x DIV (y*y)+x MOD y
2. How many types of variables are there in d) x= x DIV y*(y+x) MOD y.
PASCAL?
a) 2 2. In using DIV and '/' operator
b) 3  a) both operand must be positive
c) 4 b) at least one operand must be positive
d) 5. c) second operand is non zero
d) first operand is non zero.
3. Pointer data types are used to
a) construct dynamic structured data types 3. According to ISO standard second operand of
b) records MOD operation is:
c) files a) arbitrary number
d) static structured data types. b) non zero
c) negative
ANS: 1. d, 2. b, 3. a d) non negative. 

LESSON 18: Pascal Fundamentals-III 4. If you mix real with integers in arithmetic
expression the result must be
1. How many types of basic statements are there in a) integer
PASCAL? b) unknown c) logical
a) 2  b) 3 c) 4 d) 5. d) real. 
5. The range of real numbers in Turbo Pascal is
2. Which of the characteristics is not general to a a) 10-64 to 10+64
function? b) 10-32 to 10+32
a) A function is accessed by specifying its name. c) 10-38 to 10+38 
b) The function may return more than a single data d) 10-16 to 10+16.
item.  6. 0.0123 is displayed as
c) A function must be of correct data type for the a) 12.3E-03
expression in which it is accessed. b) 1.23E-03
d) The function name can be followed by an optional c) 12.3E-04
list of parameters. d) 0.123E-08.

ANS: 1. b, 2. c, 3. d, 4. d, 5. c, 6. a

6 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
LESSON 20: Simple Data Type -II 3. The input variable of read statement are separated
by a) tab
1. Which type of operator can not be used for b) blank space
character type data? c) commas 
a) arithmetic d) line feed.
b) relational c) logical
d) none of the above. 4. Each string in write / written statement must be
enclosed within
2. To represent Boolean data we need a) apstrophes 
a) 1 bit  b) commas
b) 2 bits c) blank space
c) 8 bits d) none of the above.
d) 16 bits.
5. The Boolean data might have a standard field width
3. The total number of relational operator in Pascal is of
a) 5 b) 2 c) 8 d) 7.  a) 6  b) 8 c) 7 d) 14.

4. While programming with logical operators ANS: 1. c, 2. b, 3. c, 4. a, 5. a


following actionsshould be taken
a) operands should be enclosed in parentheses 
b) logical operations are written first
c) operands should be enclosed in curly braces UNIT 7
d) none of the above. LESSION 23: Control Structures-I

1. The value of the following expression (sqrt(5) > 2)


ANS: 1. a, 2. a, 3. d, 4. a
AND (round(1.2)= 2)
LESSON 21: Simple Data Type-III a) True
b) False 
1. What will be the value of the expression a-b/c*sqrt c) 5 d) 2.
(d) if integer a, b, c, d have been assigned the values
1,2,3,4 respectively:- 2. The simple statements are separated from one
a) -1/6 b) -2/3 c) -1/3 another by a) commas
d) none of the above.  b) colons
c) semicolons 
2. What will be the value of the following function: d) none of the above.
round(-4.667)
a) -5  b) -4 c) 5 d) 4. 3. Compound statement is enclosed within the a) two
second brackets
3. Indicate the value of the expression:- b) two 1st brackets
chr(ord(succ(chr(ord(pred c) keyword BEGIN and END 
(’B’))+5)))-6) d) keyword IF and THEN.
a) A  b) B c) C d) D.
ANS: 1. b, 2. c, 3. c
ANS: 1. d, 2. a, 3. a LESSON 24: Control Structures-II

1. In IF - THEN - ELSE structure


LESSON 22: Input-Output a) semicolon is optional before ELSE
b) semicolon is essential before ELSE
1. Read statement is c) semicolon must be used before ELSE for
a) an arithmetic statement b) a procedure compound statements but not for simple statements 
c) an I/O statement  d) none of the above
d) both b and c.
2. Nesting level of IF - THEN - ELSE structure is a)
2. Which cannot be argument of read statement? unlimited
a) Integer b) limited upto maximum allowed code size
b) Boolean  c) limited upto Hard disk memory d) none of the
c) Real above.
d) None of above.

7 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
3. CASE structure is a 4. Which expression does not indicate the difference
a) conditional control structures between WHILE DO and REPEAT – UNTIL
b) unconditional control structures c) simple procedure?
expression a) Minimum iteration in WHILE - DO is 0 and in
d) none of the above. REPEAT -UNTIL is 1.
b) In WHILE - DO structure including statements
4. CASE statement is alternate of a) IF must be enclosed by BEGIN - END; but there is no
b) IF - THEN - ELSE  restriction in REPEAT -UNTIL
c) FOR c) In WHILE - DO increment is only 1 and in
d) DO - WHILE. REPEAT – UNTIL increment is not predefined 
d) None of the above.
ANS: 1. c, 2. b, 3. a, 4. b
ANS: 1. a, 2. d, 3. b, 4. C UNIT 8
LESSON 25: Control Structures-III
LESSON 27: Procedures and Functions-I
1.Which of the following type is not control variable?
a) Real  1. Which is not used for a parameter passing?
b) Character c) Boolean a) constants 
d) User defined variable. b) global variables c) arguments
d) none of the above.
2. The initial and final value of FOR loop may be a)
string 2. Which is not true for a subroutine?
b) logical operator a) It makes the program modular
c) relational operator b) It is easier to modify program
d) expression.  c) It reduces execution time 
3. Which of the following is equivalent? d) Debugging is easy.
a) IF and IF - THEN - ELSE
b) IF - THEN - ELSE and CASE 
c) FOR and IF
d) FOR and CASE. 3. A local variable can be used
a) inside the procedure where it is called
4. FOR loop is used for a) condition checking b) inside the procedure where it is declared 
b) repetitive statement  c) inside the program where it is declared
c) input statement d) after complete execution of program.
d) parameter passing.
ANS: 1. a, 2. c, 3. b
ANS: 1. a, 2. d, 3. b, 4. b LESSON 28: Procedures and Functions-II

1. Which is not the rule for parameter passing?


LESSON 26: Control Structures-IV a) The type of actual and formal parameters must be
same.
1. The expression in WHILE - DO structure must be b) The number of actual parameters and formal
a) conditional  parameters are same.
b) arithmetic c) logical c) The order of parameters play no vital role. 
d) a and c. d) Each actual parameter must be consistent with its
corresponding formal parameter.
2. I=8WHILE I<15 DO BEGIN
I=I+2; END 2. Which may not be value parameters?
How many times the loop will be executed a) Expression
a) 15 b) 18 c) 10 d) 4.  b) Procedure
c) Variable
3. Which structure need not be included within d) Constants.
BEGIN and END
a) WHILE - DO 3. Variable parameter exchanges information in
b) RPEAT- UNTIL  a) One way from procedure to main program
c) IF -THEN-ELSE b) Two way between procedure and main program 
d) None of the above. c) One way from main program to procedure
d) none of the above.

8 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)
4. Variable parameter passes a) must be positive integer 
a) name of the actual parameter b) value of the actual b) no restriction about +ve or -ve c) must begin from
parameter 0
c) address of the actual parameter  d) none of above.
d) none of the above.
3. What does the last program in this lesson do?
ANS: 1. c, 2. c, 3. b, 4. c a) takes 20 numbers
b) takes 20 integers and calculates their summation
LESSON 29: Procedures and Functions-III and average
c) takes 20 integers from keyboard and calculates
1. Which of the following is equivalent to a function? their summation and average 
a) Procedure  d) none of above.
b) Procedure with value parameter
c) Procedure with variable parameter ANS: 1. i) b, ii) b, iii) a, iv) a, 2. a, 3. c
d) Procedure with procedure parameter. LESSON 31: Arrays-II

2. Function can be described as 1. In the declaration of calendar how many places are
a) variable  useless and empty?
b) operator a) 675 
c) constants b) 670
d) none of the above. c) 680
d) none of the above.
3. A function can return
a) 1 b) 2 c) 3 2. Maximum number of dimensions of an array is a) 3
d) none of the above data elements.  b) 6
c) Limitless 
4. A procedure can return d) none of the above.
a) 1 b) 2 c) 3 3. An array is declared as VAR A :ARRAY [1..10,
d) none of the above data elements. 1..20] OF REAL
ANS: 1. a, 2. a, 3. d, 4. D UNIT 9 i) The number of bytes required in the above
declaration is
a) 200 b) 800  c) 20
LESSON 30: Arrays-I d) none of the above.
1. Consider the following array declaration ii) First element of the above declaration is accessed
VAR List : ARRAY [20..30] OF INTEGER by a) A[1]
i) The number of elements in the above list is b) A[0] [0]
a) 30 c) A[1] [1] 
b) 11  d) none of the above.
c) 10
d) none of above. iii) The last element is of the above declaration is a)
A[20]
ii) The number of bytes in the above list is b) A[10] [20] 
a) 30 b) 11  c) 88 d) 22. c) A[20] [20]
d) A[10] [10].
iii) To get access to the 5th element, the array
reference statement is ANS: 1. a, 2. c, 3. i) b, ii) c, iii)b
a) List[5]  LESSON 32: Records-I
b) List[10]
c) List[24] 1. Record supports
d) none of above. a) grouping of the same type of data
b) grouping of different types of data 
iv) What happens if we want to get access to List[32]? c) both a and b
a) Error message d) none of the above.
b) Garbage value
c) May get content of other data or instruction.
d) none of above.

2. Subscript of array
9 Prepared by: Pinto Datta, Cox`s Bazar Govt. Mahila College (01676509894)

You might also like