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

Programming Assign1

The document is an assignment focused on structured programming, containing multiple-choice questions and true/false statements related to programming concepts, particularly in C#. It covers topics such as the role of compilers, flowchart symbols, data types, variable naming conventions, and C# syntax. Additionally, it includes code snippets for which students must determine the output.

Uploaded by

sugin.army
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)
4 views6 pages

Programming Assign1

The document is an assignment focused on structured programming, containing multiple-choice questions and true/false statements related to programming concepts, particularly in C#. It covers topics such as the role of compilers, flowchart symbols, data types, variable naming conventions, and C# syntax. Additionally, it includes code snippets for which students must determine the output.

Uploaded by

sugin.army
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

Structured Programming

Assignment-1
Question-1: Select the correct answer for each of the following:

1. What is the role of a compiler in programming?


A. It converts high-level code into machine code for execution
B. It writes source code in programming languages
C. It helps in debugging code during runtime
D. It executes the code directly without conversion

2. What does a rectangle represent in a flowchart?


A. Process
B. Decision
C. Start/End
D. Connector

3. Which symbol is used to represent a decision in a flowchart?


A. Oval
B. Rectangle
C. Diamond
D. Parallelogram

4. What does an arrow indicate in a flowchart?


A. Process
B. Data Input/Output
C. Decision
D. Flow Direction

5. Which shape is used for the start and end of a flowchart?


A. Oval
B. Rectangle
C. Diamond
D. Parallelogram

6. The ........ method outputs data to the screen followed by a new line character.
A. Console.Write
B. Console.Writelines
C. Console.WriteLine
D. System.WriteLine

7. In flowcharts, ........ is represented by a box.


A. a decision
B. a process
C. an input
D. an output

8. In a flowchart, what does the process symbol represent?


A. Start/End
B. Decision
C. Data Input/Output
D. Sequential steps or actions

9. Which symbol is used to represent data input or output in a flowchart?


A. Oval
B. Rectangle
C. Parallelogram
D. Diamond

10. What is the purpose of a rectangle in a flowchart?


A. Start/End
B. Decision
C. Process
D. Data Input/Output
11. What is the purpose of pseudo code?
A. Represents a specific programming language
B. Provides a high-level description of a program using English Language
C. Executes and compiles directly
D. Used for debugging only

12. How are multiline comments represented in C#?


A. // This is a comment //
B. /* This is a comment */
C. # This is a comment #
D. — This is a comment —

13. Method which uses a list of well defined instructions to complete a task starting from a given
initial state to end state is calls as
A. Program
B. Flowchart
C. Algorithm
D. None

14. In c#, a char variable stores a character using ........ character encoding.
A. UTF-16
B. UTF-24
C. UTF-32
D. UTF-64

15. The chart that contains only function flow and no code is called as
A. flowchart
B. Structure chart
C. Both A and B
D. None

16. Which of the following is a program planning tool?


A. Sequential
B. decision
C. Pseudo code
D. Both B and C

17. What happens when a floating-point value (e.g., 5.35) is written without any suffix?
A. It is considered a float
B. It is considered a double
C. It is considered a decimal
D. It causes a compilation error

18. An Algorithm represented in the form of programming languages is _________


A. Flowchart
B. Pseudo code
C. Program
D. None

19. Algorithm is
A. step by step execution of program
B. Object file
C. Executable file
D. Source file

20. Every C# statement is terminated by ___.


A. Colon (:)
B. Semicolon (;)
C. Comma (,)
D. Dot (.)
21. Is C# programming language a case-sensitive?
A. Yes
B. No

22. In C#, a single-line comment starts with ___.


A. Two forward slashes (//)
B. Two backward slashes (\\)
C. A hash character (#)
D. A dollar character ($)

23. In C#, what method can convert a string to an integer?


A. Convert.ToString()
B. ToInt32.Parse()
C. Console.Parse()
D. int.Parse()

24. Which data type is used to store text value in C#?


A. text
B. txt
C. string
D. str
25. Which C# keyword is used to define a constant?
A. define
B. fixed
C. constant
D. const

26. What is the correct syntax to define a C# constant?


A. const type constant_name;
B. const type constant_name = value;
C. const constant_name as type;
D. const constant_name as type = value;

27. A flowchart should start with a ........ shape.


A. terminator
B. box
C. diamond
D. circle

28. Which is not a valid C# data type?


A. long
B. int
C. float
D. complex

29. Which of the following data types has the largest storage capacity in C#?
A. int
B. long
C. short
D. byte

30. In C#, which of the following is the correct way to declare a variable for floating point numbers with
highest precision?
A. float num = 3.14;
B. double num = 3.14;
C. decimal num = 3.14m;
D. long num = 3.14;
31. What is the size of a 'long' data type in C#?
A. 8 bytes
B. 4 bytes
C. bytes
D. 16 bytes

32. Which data type would you use in C# to store a large, precise decimal number?
A. float
B. double
C. decimal
D. long

33. How many bytes are used by a 'char' in C#?


A. 1
B. 2
C. 4
D. 8

34. What is the size of a 'bool' data type in C#?


A. 1 bit
B. 1 byte
C. 2 bytes
D. 4 bytes

35. Which data type in C# is best suited for storing a small integer value?
A. int
B. short
C. long
D. byte

36. In C#, what does the 'uint' data type represent?


A. An unsigned 32-bit integer
B. A signed 32-bit integer
C. An unsigned 16-bit integer
D. A signed 64-bit integer

37. Which of the following data types has the smallest range in C#?
A. byte
B. sbyte
C. short
D. ushort

38. Which of the following data types can store a Unicode character in C#?
A. char
B. string
C. byte
D. short

39. What type of data does the Console.ReadLine() method return in C#?
A. int
B. string
C. double
D. char

40. In the int data type, the -------- bit is used for the sign?
A. Right-most
B. Left-most
C. 2nd
D. Middle
Question-2: State whether each of the following is True or False:
1. In C#, Variable names can contain the letters ‘a-z’ or ’A-Z’ or digits 0-9 as well as the character ‘_’.
2. In C#, the name of the variables can be started with a digit.
3. In C#, the name of the variable can be any C# keyword say int, float, null, String, etc.
4. The identifier 911Emergency is a valid identifier in C#
5. The identifier Class is a valid identifier in C#
6. In C#, the identifiers Choice and choice are the same.
7. The identifier name bool is valid in C#.
8. The name my-Location is a valid variable identifier in C#
9. The code of the program in C# is usually written within a method called main().
10. The name _Location is a valid variable identifier in C#.
11. The name @Email is a valid variable identifier in C#.
12. The name Student Location is a valid variable identifier in C#.
13. In C#, the data type System.Int16 is equivalent to long data type.
14. In C#, the data type System.Int8 is equivalent to sbyte data type.
15. In C#, the data type System.Short is equivalent to short data type.
16. In C#, the data type System.Double is equivalent to double data type.
17. In C#, a variable of the data type bool takes only a 1-bit of storage space in the memory.
18. In C#, a variable of the data type char takes 2 bytes of data storage in the memory.
19. In C#, a variable defined using the statement string name =”Zaki”; takes 4 bytes of data storage in the
memory.
20. A string variable in C# stores a reference to a sequence of the characters that constitute this string.
21. Overflow occurs when a value is assigned to a variable outside of its defined range of values.
22. It is allowed to store integer values in variables defined of the double datatype.
23. The decimal datatype has lower precision than the double datatype.
24. The using keyword is used for including the namespaces in the program.
25. 12356 is a valid int literal in C#.
26. 123.56m is a valid double literal in C#.
27. 12356 is a valid double literal in C#.
28. 312569E-5 is a valid double literal in C#.
29. 312569E is a valid double literal in C#.
30. 784f is a valid double literal in C#.
31. 723.33 784f is a valid double literal in C#.
32. 12356 is a valid float literal in C#.
33. 123.56 is a valid float literal in C#.
34. 12356f is a valid float literal in C#.
35. C# is a case sensitive language.
36. All variables in C# are defined of value data types.
37. $name variable is a valid identifier in C#
38. The using directive in C# Is used to defines variables
39. In C#, a variable defined of double data type has more precision that a variable of the data type type float.
40. Negative integer numbers can be stored in uint data type.
41. A Single character can be stored in a variable of char data type.
42. The type string in C# is a reference data type.
Question 3: What is the output of each of the following code snippets?
1.
using System;
public class GFG{
static void Main(string[] args)
{
Console.WriteLine("Geeks ");
Console.WriteLine("For ");
Console.WriteLine("Geeks ");
}
}

A- Geeks For Geeks


B- Geeks For Geeks;
C- Geeks
For
Geeks
D- “Geeks For Geeks”

2.
using System;
public class GFG{
static void Main(string[] args)
{
Console.Write("Geeks ");
Console.WriteLine("For ");
Console.Write("Geeks ");
}
}

A- Geeks For Geeks


B- Geeks
For Geeks;
C- Geeks
For
Geeks
D- Geeks For
Geeks

3.
using System;
public class GFG{
static void Main(string[] args)
{
Console.Write("Geeks ");
Console.WriteLine("For ");
Console.Write("Geeks ");
}
}

A- Geeks For Geeks


B- Geeks
For Geeks;
C- Geeks
For
Geeks
D- Geeks For
Geeks

You might also like