Sunday, April 20, 2025

C Programming Viva Questions Data Types

Viva Questions based on C Programming Data Types

 

1. What are data types in C?

Answer: It defines the type of data that we can store in a variable. They tell the compiler how much space to allocate and how to interpret the value.

 

2. What are the different types of data types in C?

Answer: C has three primary data types:

•   Basic data types: int, float, char, double

•   Derived data types: array, pointer, structure, union

•   Enumeration and void types: enum, void

 

3. What is the size of int, float, double, and char in C?

Answer: Sizes may vary by system, but typically:

•   int: 4 bytes

•   float: 4 bytes

•   double: 8 bytes

•   char: 1 byte

 

4. What is the difference between float and double?

Answer:

•   float is a single-precision (32-bit) floating point.

•   double is a double-precision (64-bit) floating point. double is more accurate and can store larger values.

 

5. What is the use of the void data type?

Answer: void means “no type.” It is used:

•   In functions that return nothing: void functionName()

•   For generic pointers: void *ptr

 

6. What is the difference between signed and unsigned data types?

Answer:

•   Signed data types can store both positive and negative values.

•   Unsigned data types can only store positive values, which allows a larger positive range.

Example:

signed int ranges from2,147,483,648 to 2,147,483,647

unsigned int ranges from 0 to 4,294,967,295

 

7. What is the use of sizeof operator?

Answer: The sizeof operator returns the size (in bytes) of a data type or variable.

Example: sizeof(int) gives 4 on most systems.

 

8. What are type modifiers in C?

Answer: Type modifiers are keywords that alter the meaning of the base data types.

They are: signed, unsigned, long, and short.

Example: unsigned long int increases the range for positive integers.

 

9. Can we use char for storing small integers?

Answer: Yes. A char is 1 byte, so it can store small integer values (typically –128 to 127 for signed char).

 

10. What happens if we assign a float value to an int variable?

Answer: The decimal part is truncated, not rounded.

Example:

float x = 5.9;

int y = x; // y becomes 5

 

 

Friday, January 24, 2025

Important Computer Network Terminology

Hello Reader,

If you have an interest in network programming, it's essential to familiarize yourself with the following key terminology associated with computer networks.  

Basic Networking Terms

  1. IP Address: A unique identifier assigned to a device on a network.
  2. Subnet Mask: Defines the network and host portions of an IP address.
  3. MAC Address: A unique identifier assigned to a device's network interface card (NIC).
  4. Gateway: A device that connects different networks and facilitates communication.
  5. DNS (Domain Name System): Translates domain names to IP addresses.
  6. DHCP (Dynamic Host Configuration Protocol): Assigns IP addresses automatically to devices on a network.
  7. LAN (Local Area Network): A network that spans a small geographical area.
  8. WAN (Wide Area Network): A network that spans a large geographical area.
  9. VPN (Virtual Private Network): Creates a secure connection over a public network.
  10. SSID (Service Set Identifier): The name of a wireless network.

Protocols

  1. TCP (Transmission Control Protocol): Ensures reliable data transmission.
  2. UDP (User Datagram Protocol): A connectionless protocol for faster, less reliable data transmission.
  3. HTTP (Hypertext Transfer Protocol): Used for transferring web pages.
  4. HTTPS (HTTP Secure): A secure version of HTTP.
  5. FTP (File Transfer Protocol): For transferring files over a network.
  6. SMTP (Simple Mail Transfer Protocol): Used for sending emails.
  7. IMAP (Internet Message Access Protocol): Accesses emails on a server.
  8. SNMP (Simple Network Management Protocol): Manages network devices.
  9. ICMP (Internet Control Message Protocol): Used for error reporting and diagnostics (e.g., ping).
  10. ARP (Address Resolution Protocol): Maps IP addresses to MAC addresses.

Network Devices

  1. Router: Directs data packets between networks.
  2. Switch: Connects devices within a LAN.
  3. Hub: A basic device to connect multiple devices in a network.
  4. Modem: Connects a network to the internet.
  5. Firewall: Monitors and controls incoming and outgoing network traffic.
  6. Access Point (AP): Provides wireless connectivity in a network.
  7. Bridge: Connects two LANs.

Security Terms

  1. Firewall: A device or software to block unauthorized access.
  2. Proxy: Acts as an intermediary between clients and servers.
  3. Encryption: Secures data by converting it into an unreadable format.
  4. Authentication: Verifies the identity of a user or device.
  5. VPN Tunnel: An encrypted connection within a VPN.
  6. Intrusion Detection System (IDS): Detects unauthorized access attempts.
  7. Intrusion Prevention System (IPS): Prevents unauthorized access.

Network Types

  1. MAN (Metropolitan Area Network): Covers a city or a large campus.
  2. SAN (Storage Area Network): Dedicated for data storage.
  3. PAN (Personal Area Network): Covers personal devices (e.g., Bluetooth).
  4. CAN (Campus Area Network): Covers a campus or organization.
  5. IoT (Internet of Things): A network of interconnected smart devices.

Advanced Concepts

  1. NAT (Network Address Translation): Maps private IPs to public IPs.
  2. QoS (Quality of Service): Prioritizes network traffic.
  3. BGP (Border Gateway Protocol): Manages routing between autonomous systems.
  4. MPLS (Multiprotocol Label Switching): Directs data using labels for efficient routing.
  5. Load Balancer: Distributes network traffic across multiple servers.
  6. VLAN (Virtual LAN): Segments a network into logical parts.
  7. Cloud Networking: Using cloud-based infrastructure for networking.

Measurement and Monitoring

  1. Bandwidth: Maximum data transfer capacity of a network.
  2. Latency: Time delay in data transmission.
  3. Throughput: Actual data transfer rate.
  4. Packet: A small unit of data transmitted over a network.
  5. Ping: Tests network connectivity and measures latency.
  6. Traceroute: Tracks the path data takes to reach its destination.


< Back to Networking Page >