WorksheetsRTES
Total questions: 10
Worksheet time: 5mins
Explain the process of compilation and linking in C.
Compilation in C only includes converting source code to machine code without any linking process.
The process of compilation and linking in C includes preprocessing, compiling to assembly, assembling to object code, and linking to create an executable.
The process of compilation in C involves only writing code without any further steps.
Linking in C is the same as executing the program directly without compilation.
What are preprocessor directives in C? Provide examples.
#include
#define E 2.71
#if RELEASE
Examples of preprocessor directives include: 1. #include
Differentiate between static and dynamic memory allocation in C.
Static memory allocation is fixed at compile time, while dynamic memory allocation is flexible and occurs at runtime.
Static memory allocation can be resized during program execution, while dynamic memory allocation cannot.
Static memory allocation occurs at runtime, while dynamic memory allocation is fixed at compile time.
Dynamic memory allocation is done at compile time, while static memory allocation is flexible and occurs at runtime.
What is the difference between break and continue in C? Provide examples.
'break' is used for function calls; 'continue' is for loops only.
'break' and 'continue' have the same effect in loops.
'break' skips to the next iteration; 'continue' exits the loop.
'break' exits the loop; 'continue' skips to the next iteration. Example: for (int i = 0; i < 5; i++) { if (i == 2) break; // exits loop when i is 2 printf("%d ", i); } for (int i = 0; i < 5; i++) { if (i == 2) continue; // skips the rest of the loop when i is 2 printf("%d ", i); }
Define a string in C and explain how it is declared. What is the last element in a string?
The last element in a string is the first character.
The last element in a string is a space character.
The last element in a string is a comma.
The last element in a string is the null character '\0'.
Write a C program to check if a number is even or odd using the bitwise AND operator.
Use the expression 'if (number & 1) { printf("Odd\n"); } else { printf("Even\n"); }' in the C program.
Use 'if (number & 2) { printf("Even\n"); }' to check for even numbers.
Check if 'number / 2' is an integer to determine if it's even or odd.
Use 'if (number % 2 == 0) { printf("Even\n"); }' to check even numbers.
List the basic components required for designing a digital clock using Arduino and describe their roles.
Bluetooth Module
Speaker Module
Microcontroller Unit (MCU)
Arduino Board, Real-Time Clock (RTC) Module, Display (LCD or 7-segment), Power Supply, Connecting Wires
Write a program for a digital clock using Arduino.
rtc.setTime(12, 0, 0);
#include
lcd.print(now.day());
#include
What are the basic components required for designing a smart card reader using Arduino and their roles?
Arduino board, smart card reader module, power supply, connecting wires
Microcontroller, smart card emulator, Ethernet cable, soldering iron
Arduino board, barcode scanner, solar panel, HDMI cable
Raspberry Pi board, RFID reader module, battery pack, USB cables
Explain the architecture of an automated meter reading (AMR) system with a block diagram.
Analog Meter, Local Display, Manual Data Entry, and Printer
Smart Meter, Cloud Storage, Mobile App, and Backup Server
The architecture of an AMR system includes Meter, Communication Module, Data Collector, Central Server, and User Interface.
Power Supply Unit, Data Logger, User Manual, and Network Switch
