0% found this document useful (0 votes)
27 views3 pages

KMK1093 Lab Exercise Week 01 - 2023

This document contains instructions for a lab exercise in a basic C++ programming course. It includes multiple choice and short answer questions to test students' understanding of topics like the differences between general purpose and specific application software, the advantages and disadvantages of C++, guidelines for selecting a C++ IDE, and definitions of source and object programs. It also provides code examples to modify and test compilation errors for concepts like preprocessor directives, variable declarations, using namespaces, semicolons, and braces. Students are asked to write additional programs to display text patterns and personal information.

Uploaded by

hazimizzat124
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)
27 views3 pages

KMK1093 Lab Exercise Week 01 - 2023

This document contains instructions for a lab exercise in a basic C++ programming course. It includes multiple choice and short answer questions to test students' understanding of topics like the differences between general purpose and specific application software, the advantages and disadvantages of C++, guidelines for selecting a C++ IDE, and definitions of source and object programs. It also provides code examples to modify and test compilation errors for concepts like preprocessor directives, variable declarations, using namespaces, semicolons, and braces. Students are asked to write additional programs to display text patterns and personal information.

Uploaded by

hazimizzat124
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/ 3

[LAB 1 EXERCISE, WEEK 4] October 30, 2023

LAB 01
KMK1093 BASIC PROGRAMMING
SEMESTER 2023/2024-1

1 KMK1093 Basic Programming | [ FCSHD ]


[LAB 1 EXERCISE, WEEK 4] October 30, 2023

LAB 01
KMK1093 BASIC PROGRAMMING
EXERCISE 1.0

1. Distinguish between “General Purpose Application Software” and “Specific Application Software” ? (if possible
try to relate with the Cognitive Science niche areas)

2. What are the advantages and disadvantages of C++ Programming Language ?

3. Discuss “possible” guidelines to be followed by a programmer in selecting C++ IDE (Integrated Development
Editor). Explain to students “Installation Procedure”, Dev C++, Netbeans, Code Blocks and any Android C++ IDE

4. Distinguish between a source program and an object program

5. Why the machine language called the lowest level language?

EXERCISE 1.1

// Program code : lab01-1.cpp


// Programmer :

#include<iostream>
using namespace std;
int main()
{
cout << “This is our first C++ Program.”<<endl;
cout << ”It Works!”<<endl;

return 0;
}

For each experiment concerning lab01-1.cpp, start with a fresh copy of lab01-1.cp and make the indicated changes
(question 1-question 4) :

1. Delete the #include<iostream> preprocessor directive from lab01-1.cpp. Attempt to compile and
executing the resulting program. What message does your compiler issue ?
2. C++ is case sensitive. Replace the I in the preprocessor directive #include by I and compile the resulting
program. What message does your compiler issue ? Now replace the word cout by COUT. What message the
compiler issue ?
3. Every C++ statement must end with semicolon (;). Intentionally omit the semicolon at the end of the first cout
statement and compile the resulting program. What message does your compiler issue ?
4. The body of the function main( ) must be enclosed in braces { }. Omit either the left brace { or the right brace }
and compile the resulting program. What message does your compiler issue ?

2 KMK1093 Basic Programming | [ FCSHD ]


[LAB 1 EXERCISE, WEEK 4] October 30, 2023

EXERCISE 1.2

1. Which of the following variable declarations are correct? if a variable declaration is not correct, give the
reason(s) and provide the correct variable declaration.

N = 12; //Line 1
character letter = ; //Line 2
INT one = 5, two; //Line 3
Double x, y, z; //Line 4

2. Modify the following program so it prints two blank lines between each line of text.

#include<iostream>
using namespace std;
int main( )
{
cout<<”C++ Primer is a highly recommended, well organised and well-written book “;
cout<<”for those who want to learn C++.”;
cout<<”It is a very thorough introduction to the language in a very accessible format,”;
cout<<”with plenty of examples and explains everything in the language in great detail.”;
return 0;
}
3. Define a correct data type for the following variables :
 GST rate
 Number of students
 Vehicle/Car Brand and Name (such as Subaru, Mitsubishi, Toyota Fortuner, Perodua Alza)
 Book category code

4. Write a program that displays “C++” text in block form using asterisks

5. Write a C++ program that prints out the message below.

6. Write a Personal Information program that displays the following information, each on a separate line:
 Your name, Your address, with city, state, and zip code,
 Your telephone number and
 Your Undergraduate program and your faculty name

3 KMK1093 Basic Programming | [ FCSHD ]

You might also like