[go: up one dir, main page]

0% found this document useful (0 votes)
60 views7 pages

CSC203 Programming and Problem Analysis

The document contains a series of multiple-choice questions related to C++ programming concepts, including variables, data types, control structures, and functions. It also includes questions about the Software Development Life Cycle (SDLC) and practical programming tasks. Additionally, there are sections that require the creation of simple C++ programs and flowcharts to demonstrate understanding of the concepts.

Uploaded by

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

CSC203 Programming and Problem Analysis

The document contains a series of multiple-choice questions related to C++ programming concepts, including variables, data types, control structures, and functions. It also includes questions about the Software Development Life Cycle (SDLC) and practical programming tasks. Additionally, there are sections that require the creation of simple C++ programs and flowcharts to demonstrate understanding of the concepts.

Uploaded by

derrybandoh100
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 7
ANSWER ALL QUE: [S BY SELECTING THE RIGHT ANSWER FROM THE AVAILABLE OPTIONS IN THIS SECTION 1, Whats a variable in C++? A. Atype of function B. Astorage location paired with an associated name C. Anerror in the code D. Atype of C++ operator N Which data type is used to store a single character in C++? A. int B. double Cc. char D. string 3, What does the 'if statement do in a C++ program? A. Declares a variable ‘B. Executes a block of code if a condition is true C. Stops the execution of the program D. Prints something on the screen 4, Which of the following is a logical operator in C++? it Bayo C. && a 5. How do you start a single-line comment in C++? Aue: [*. B. ** i ’ Col \ DN 6. What value does the following expression return? 1! A. 10 B. Error Cc. False 4 ‘D. True | + Which header file is required io use cout? A. string BL 8 What isthe ouput ofthe following code snippet if = 59 e<10) cout << "Hello"; AS B. Hello C. Error D. No output 9. Which keyword is used to create a function in C44? A. funetion B. void def D. fun 10. What is the correct way to declare an integer variable named age’ in C+? A. intage; B. integer age; C.intage () D. age int; 11. Which operator is used to add two variables in C++? panes B ct Ds 2 12. Which keyword is used to check a condition in C+4? AL switeh B. for Sit D. while 13. What willbe the output ofthe following code if the input is 32 int x; cin >> x; if > 5) cout << "Greater"; else cout << "Smaller": A. Greater B. Smaller C. Error D. No output 14. Which data type is not a primitive datatype in C++? AL int s BL char string “Be float bien A r a ————— How can yo ne —_ ‘block of code under a condition in C4? B, forloop C. continue : D. break »- What isthe purpose of the return statement in C++ functions? - ‘Stops execution and exits the program: B! Only exits the function _Retums a value from a funetion D. None of the above 7, What keyword is used to define a constant in C++? A. define B. const ©. continue D. con Wh 6+ conol straws ort exeetion pas seo the vasa A If -B. While 7K Switch * D. Goto 19, Whats the comet syntax for a fantion turing no vale in cH? ‘A. void functionName(); B. function voidName(); C. None void(); D. Noreturn funetionName(); 20, Which ofthe fllowing corectly shows fnetin declaration in C++? ‘A. intaddlintx, inty) B. int add(int x; int y) C._- fumetion addnt x, int y) D. _adatint x, ity) 21. How doyou declare a function that takes two floats and etums thei mul double? ‘A. double multiply (float x, floaty); B. float mutiply(double x, double y); CC. int multiply (float x oat); D. void multplyfloat x, floaty); 22, What is the purpose of the if statement in C+? A Tosdafine a viriable B. Toexceute a block of code if a condition is true C. To declare a function #0. Toenda oop 23. How can you include multiple conditions in an if statement in C++? A. Using the && operator B. Using the | operator €. Using either && or || operators D. You cannot include multiple conditions 24, Which operator would you use to cheek if two variables are not equal in an if statement A =| Do <> 25. What does the else part of an else slatement do? A. Ttexcoutes ifthe if condition is tue B. _Itexeoutes ifthe if condition is false C. Walvways executes D. Itnever executes 26. Which data type would you use to store a boolean value i AL int B. bool Coat D. double 27. What is the size ofa char data type in C++? A. Lbyte B. 2bytes i C. 4 bytes D. Bbytes 28. Which datatype i typically used to store large integers in C+¥? A. short B. int °G. long long D. double 29. What is the primary difference between float and double data types in C++? A. Precision B. Size C. Both AandB “D. There is no difference r eee Which data ype would you use for arable that olds decimal numbers with ess precision requirement? A. oat B. double Cc. int D. long 1. In C+, which datatype requires the last amount of memory’? AL int Bo char C. flat D. double 32. What defines a first-generation programming language? ‘A. High-level language features B. Use ofsymbolic names instead of numbers C. Machine language specific to each type of computer D. Use of simple commands in English 33, Which generation of programming I guages is associated with assembly languages? A. First generation B. Second gencration C.Third generation D. Fourth generation 34, ‘Third- generation programming languages a primarily characterized by what fenture? ‘A. Machine code instructions B, Hiuman-readabe code C. Use of symbols and. abbreviations D. Use of natural language processing 435. Which ofthe following i an example ofa third-generation programming language? A. COBOL B. SQL C._ Prolog D. Assembly 36, What does SDLC stand for in software development? |A. Software Design and Lifecycle B. System Development Life Cycle ©. Software Development Life Cycle D. Secure Data Link Control 37. Which SDLC phase involves gathering information from stakeholders? A Implementation B, Testing C. Requirement D. Maintenance 38 39, 40. In which SDLC phase is the software actually built? A. Analysis B. Design C.Implementation D. Deployment What is the primary focus of the Testing phase in SDLC? A. To determine system requirem ; B. To integrate different system modules G.To.find and fix defects D. To deploy the appl ion to production sae C phase are system and software architecture designed? B. Analysis C. Design D. Implementation SECTION B Answer ONLY ONE question in this seetion Question 1 8) Discuss the importance of choosing the correct data type when declaring a variable in C How does it afeet program performance and memory usage? +b) Outline the key stages of the Software Development Life Cycle (SDLC). Briefly deseribe 1 ‘main objectives and activities of each stage and discuss how they contribute to the over success of a software developinent project. Write a simple C+ program to simulate a supermarket transaction. The program should all the user to input the quantity and price for three different products (e.g. bread, milk, and egg ‘After calculating the subtotal for the items purchased, apply a tax rate of 7% to determine t total cost. Display the subtotal, the tax amount, and the total cost of the purchase. U appropriate variables, inpuvoutput statements, arithmetic operations, and constants ° complete this task. Question 2 8) Write a simple C+ program to simulate an ATM machine transaction. The program shoul allow the user to input their account balance, Provide options for the user to withdraw mone, ‘or deposit money into their account. After each transaction, update the account balance an display it. Use appropriate variables, input/output statements, and control structures to manag, the transaction flow and user inputs. Consider basic error handling, such as ensuring the user ‘cannot withdraw more money than the account contains. Drawa flowchart fo represent the process of checking i'a number entered by the user is even or odd, Your flowchart should start with the wer npn a mur, and end wit ili ‘Eve ifthe number i visible by 2, an "Ot oterise nl al relevant decision poms psc inyour Nowe Given the C+ program above, determine what wil ete output when itis exeeted EDI ‘wy the output is produced based on the operations performed inthe loop andthe condiioet statement include using namespace std; intmain(){ intx=5,y=3; int result=1; for (inti=0;i

You might also like