0% found this document useful (0 votes)
31 views6 pages

Introduction To Programming (2013)

The document contains 6 sections with multiple choice questions about programming concepts in C++ such as data types, operators, control structures, functions and arrays. It tests the understanding of basic programming constructs and syntax in C++.

Uploaded by

prashanthan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views6 pages

Introduction To Programming (2013)

The document contains 6 sections with multiple choice questions about programming concepts in C++ such as data types, operators, control structures, functions and arrays. It tests the understanding of basic programming constructs and syntax in C++.

Uploaded by

prashanthan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

www.hnditmediaunit.

com
[1111 Ri&hts ~~J

I I!~~!!mrrE
® , ,. . . . ._In_ . . . . . . OF ADVANCED TECHNOlOG'~"DUW'ON
"' w..'-,,............... _In ........ '/'!IN I!I'I ~I

Higher National Diploma in Information Technology


First Year, 151 Semester Examination _ 2013

IT 1003 -Introduction to Programming (New)


t nSlnCliolls ror C. ~d id.la:
AlI$wer fi~ (OS) qu~ioIIS only.

Timf : ThrH (OJ) hou n Noofpagcs 06


No of qllCSlioos: 0&

~) What is meant by tenns source code and ObjIXI code in programming? 104 Marks]

b) What is pseudo code?

c) What are the symbols used in flow charting \0 indicate following.

l. in put II. Start/End III. Process I V. Decision 104 Marksl

d) What is the expected o utput of the following pseudo code? 102 Mar ks1

Begin
X= l
While X< IO
X: X+ t
End while
Display X
Eoo
e) Write pseudo codes to inpullwo numbers and display Ihe smaller ollC. 104 Marks]

f) Draw a flowchart 10 find largest number of given 6 numbers. I06Marksj

(Total Marks 201

H/vDlT · IT 100J l"tf"OdMct;qn tq Prqg"mfl"i"g(New) :lOIJ


{
, .
1
www.hnditmediaunit.com

(2) a) What is a meaning of" keyword" in programming? [03 Marks]

/ b) Write keywords used in e++ to pcrfonn foll owing tasks.

I. Declare a eonSlanl

o Im media tely exit from a loop

I II. Declare a variable to hold a large integer

IV. Declare a variable to hold a num her wi th dec imal values

v. Declare a class [OS Marks!

c) Writc following statements usi ng ari thmetic assignment operators.

I. number=numbt-r+ 12

II . number=number"% 12

III . number=nu mbcr· 12 [03 Marks]

d) Write output of lhe following program segments.

illt NoS!ud~ - 135 :


cout « "Number of\"students\" is" :
cou! «"\n" :
cout « NoSlUds :

II . int ClassFivc = 10:


int ClassSix - 12;
in! ClassScven = 14 :
cout « "A verage age of students of class 5.6 and 7 is •. :
..:oul« "IC « ClassF;ve « "\('« ClassSix «"\t"« ClassSeycn :

@ cou\« (10+20);
cout«(O IO):
couI«(OIO+ IO):
eou\« (OIO+O IO):
[09 Marks ]
[Total Marks 20]

IINDIT - IT 100J ',,'NHlu~lilHllo Prog'_lfIjllgfN_J 10fJ


2
www.hnditmediaunit.com

(3) a) Mention the reasons for the following error messages? 109 Marks]

i. Info ;Compi ling H;\c++\source codes\function.cpp


error: functi on.cpp(1 0.6):SI3tcment missing;

ii. Info :Compi li nK I-I:\c++\source codes\funcl ion.cpp


Error: funclion.cpp( 13.8):Cali lo undefi ned function 'gelch'

iii. Inlo ;Compiling H:\c++\source codcs\fu nclion.cpp


Error: funclion.cpp(7. 10):UnOcfined symbol 'n'

b) What is the syntax of i/ .. eI.'i4! statemen r! [03 Marks]

c) What is the out put of the following progra m? [02 Marksl


lIoid mainO

in t Iirst"" IO,5crond"'20;
if (fi rst>sccond)
cout«"FlRST":

,''''
cout«"SECOND":

d) Write a c++ program to in[)U t a~>e ora person and display the relellant result according
to the follollling criteria. [06 Marks1
Age<-3 ~ Free

3>Age <- 12 ~ Half


12>Age ~ r ull
fTotal Marks 20J

,
IINDIT . IT looJ h"rotfuclion 10 P'/lg'(j"'mln1f(N~) 200
www.hnditmediaunit.com

(4) a) What is the role ofllinclude direct ive in e++? 102 Marksl
/
b) What is the difference between local and global variables? (03 Marksl

e) Identify local/global variables from following code segment. [03 Marksl

lIinciude <iostream.h>
int x:
void mai nO
I
float y;
fOf(in t z=O;z<IO;z++)
cou t«x;

d) What is meant by funct ion prototype? [02 Marks l

~BrieflY explain the use of defa ult arguments in a function. C02 Marks l

f) Write and test the following function that rctums the minimum value of the 3 integers

given as arguments. [08 Marks ]

int min(int a. int b. in t c); (TOlal Marks 20]

(5) a) Write syn tax of while loop and do while loop. [04 Marks l

b) How do you choosejorloop and while loop? [03 Marks]

e) What is the expected output oflhe following code fragment? 103 Marksl

while(20)
I
Cou\«"SL IATE";

d) What do you meant by nested loops? 102 MarksJ

IINOI T · I T 100J t"frodMCli""lo Prou~fIK(N_) 10l J


4
www.hnditmediaunit.com

e) Write a program to ge nerate following pattern. 08 Marks]

######
#####

.'"
####

#
frotal Marks 201

(6) a) Using an example e:<plain the following, f06 Marks]

I. Declare an array called " marks" of typc ·'int" and that should be able to hold 10
valucs.

II. Initial ize abovc army with fo llowing valucs.


75,45.65 ,78.90,87.43,25.63,96

b) Write c++ statcmcnts to do the fo llowing.

I. Declare an array "Number" of 15 elements o f the type int. (01 Marksl

II. Output the value oftcnth element of array "Number". 102 Marks]

III . Sct the value of fifth elemcnt of array "Numbcr" to 25. (02 Marks]

IV . Sctthe value of ninth element of the array "Nu mber·' to the sum of sixth and seventh

elements of the array "Number'·. [02 Marks]

V, Set the value of the fou nh clement of the array "Number'· to three times the value of

eighth element. [02 Marks]

VI. Output array "Number" so that five elements per line are printed. [05 Marks]

[Total Marks 20J

IINo/T - IT 1001 Introduction 10 Programmil,x(","", 1011


5
www.hnditmediaunit.com

j> a) What is a pointer in c++? [02 Marks]

b) What operator is used to determine the addrcss ofa va riable? [02 Marks]

c) Suppose that you have a int pointer variable calted "x", Write statement that prints the

value ofx. [03 Marks ]

d) What is the syntax of switch statement in c++? [04 Marks]

e) Write a program that take a character as an input and print the relevant word according to

the following instructions. [09 Marks]

if the character is
A - Apple
B - Banana
G - Grapes
o -Orange
M - Mango
An y other character - " Incorrect InpuC
[Total Marks 201

, a) What is the use of pri vate and public members in a class? 104 Marks]

b) Define a class called 'Student' wi th ·stu·number', ' name' and 'age' as attri butes and

'setDate' and 'printOata' as fu nctions to input data and output data respectively,

[06 Marks]

c) Write a main function to do the following . 106 Marks )


I, create two objects of student class

11 . in put data to the lirst student

III . Print data of the first student

d) Explain single inheritance'and mulliple inherilance. (04 Marks]

[Total Marks 20]

HNDlT · IT 100J Introduction /II Prog,umming(Nn.» 100


6

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy